krunal pande

krunal pande

  • 1.8k
  • 83
  • 10k

display FinalResult column 2 times with different name and

Nov 21 2017 1:28 AM
Hi team,
 
 i have one table  with field .
 
empcode varchar(100),
FinalResult varchar(100),
date datetime
 
i want result like
 
 
 display FinalResult column 2 times with different name and different where condition in single select statement
 
 I used below query  it gives  present count right but wrong absent day count
 
select empcode,count(finalresult),(select count(finalresult) from elcm_mahsqa.tna.rostering where date between '2016-06-01' and '2016-06-15' and finalresult='a' ) as 'fg' from elcm_mahsqa.tna.rostering where date between '2016-06-01' and '2016-06-15' and finalresult='p' group by empcode.
 
 
please suggest any solution. 

Answers (2)