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 NandekarRank #703 · 3.4K reputationPosted Apr 19, 2011, 11:05 PM EDT
Shyja Abraham66 reputationPosted Apr 20, 2011, 1:58 AM EDT
Ankit NandekarRank #703 · 3.4K reputationPosted Apr 20, 2011, 2:12 AM EDT
CrishRank #1,487 · 1.1K reputationPosted Apr 20, 2011, 2:59 AM EDT
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
Vijay YadavRank #1,637 · 943 reputationPosted Apr 20, 2011, 3:00 AM EDT
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
Ankit NandekarRank #703 · 3.4K reputationPosted Apr 20, 2011, 3:09 AM EDT
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.