i have 3 tables 1st contains regno,studname,classid,parent,address- named registration .
2nd contains classid,classname,fees etc named class.
3rd contains feeid,regid,classid,feedate,total -named fee.
i want to select at tne end of month list of student whose are not paid the fee.
select regno,studname,classname,parent,address from both registration and class whose are not paid the fee in the corresponding date?
plz help.
Loading
Ankit NandekarPosted Apr 20, 2011, 7:09 AM
SELECT Reg.regid,Reg.studname [Student Name] ,Reg.parents ,Reg.address,
cls.classname [Class]
FROM dbo.registration Reg
INNER JOIN dbo.class cls ON cls.classid=Reg.classid
INNER JOIN dbo.fee f ON f.classid=cls.classid
group by Reg.regid,Reg.studname, Reg.parents ,Reg.address,cls.classname,feedate
having DATEDIFF (dd,feedate,getdate())>20 and avg(total)-sum( cls.fees)>0
here i take fees fiels as a paidfees and toatal fees as a total class fees.
Vijay YadavPosted Apr 20, 2011, 7:00 AM
select r.regno,r.studname,c.classname,r.parent,r.address from registration r join class c on r.classid=c.classid where r.date between 01/04/2011 and 20/04/2010
CrishPosted Apr 20, 2011, 6:59 AM
regid,studname,regno,classname,dob,sex,parent,houseno,place1,place2,city,phono,mobno,office,offplace1,offplace2,offcity,offpho,offmob,fax,nationalty,busno
from
registration r inner join class c on r.classid = c.classid
inner join bus b on r.busid = b.busid
where
r.Studname = @StudName -- @studname is the parameter
Ankit NandekarPosted Apr 20, 2011, 6:12 AM
Shyja AbrahamPosted Apr 20, 2011, 5:58 AM
Ankit NandekarPosted Apr 20, 2011, 3:05 AM