Click here to Skip to main content
15,884,425 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Att_Date , Att_ScheduledShift , att_status
...................................................................................
2014-01-01 , GENShift , Absent
2014-02-04 , NIGHTshift , present
2014-03-05 , GENShift , leave



i want out put like this formate only

Att_Scheduleshift , Absent , present
..........................................................
Genshift , 5 , 1
NIGHTshift , 2 , 0
Posted
Updated 30-Jan-14 20:28pm
v3

1 solution

check the column name and table name at the below query

SQL
select Att_Date ,Att_ScheduledShift ,'absent'=case when att_status ='absent' then count(att_status)else 0 end ,'present'=case when att_status ='present' then count(att_status) else 0 end from Attendance group by Att_ScheduledShift ,Att_Date ,att_status


better you use att_status as integer 0 and 1
 
Share this answer
 
v2
Comments
Member 10562086 31-Jan-14 2:36am    
thanks for your answer sir.but i actualy i am paasing Att_date And att_scduleshift from my code on particlor date and schedulshift i want how many are present and how many absent status ,,so i want display this table into my grid view means dynamically bind grid view ,,,please help me sir ,,,,and my table name is "Attendance" and even ther is not only present and absent status in my att_status,even around 20 Att_status is there like absent ,present ,leave,half day,fullday,weakoff.,,,,,,etc soo please help me
King Fisher 31-Jan-14 2:44am    
attendance=1

leave=0

2014-01-01 , GENShift , 1
2014-02-04 , NIGHTshift , 0
2014-03-05 , GENShift , 0

store the recards like this

att_status datatype should beinteger
Member 10562086 31-Jan-14 2:57am    
in bellow structure i want get out put from query ,,,,

Att_sheduleShift, Att_date, present ,absent, leave, Wo, halfday
genralshift 1-2-2014 2 3 2 0 2
nightshift 2-2-2014 3 1 0 5 1


in my Att_status column contain :present ,absent ,leave,halfday,Wo,etc,,,,
King Fisher 31-Jan-14 3:58am    
whats your table structures with datas?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900