How to change this Sql Query any one solve this

Posted by Jayakumars under ASP.NET on 9/30/2011 | Points: 10 | Views : 1072 | Status : [Member] [MVP] | Replies : 1

How to change this Sql Query any one solve this i have attached 3 Jpg
1.File1-> Table-I.JPG

below my Query but this is not correct My Query show last image file
Select Distinct StdStandard,Count(*)as Cnt1,StdRegisterNo from Tbl_Students TBS left join Tbl_StdFeeAllocation TBF on
TBF.StdRegisterNo= TBS.StdRegNo group by StdStandard,StdRegisterNo

But i need below output
Standard CountStudentFeePaid CountStudentFeeNotPaid
I 3 0
II 0 1
III 3 1
IV 1 0
V 1 0

Mark as Answer if its helpful to you


Posted by: Hmanjarawala on: 10/18/2011 [Member] Bronze | Points: 25

Hi have this

select ts.stdstandard,count(1) as cnt,tf.stdregno
from tbl_fee tf right outer join tbl_students ts on tf.stdregno=ts.stdregno
group by ts.stdstandard,tf.stdregno

Himanshu Manjarawala
Sr. Software Engineer@AutomationAnywhere

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response