• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
need sql query output like this

#2
This should do it.

Code:
SELECT temp_time as time_stamp, SUM(AM) as FN, SUM(PM) as AN, count(temp_time) AS `count` FROM (SELECT DATE_FORMAT(`time_stamp`,'%d-%m-%Y') AS temp_time, DATE_FORMAT(`time_stamp`,'%p') AS AM_PM, IF((SELECT AM_PM)='AM',1,0) AS AM, IF((SELECT AM_PM)='PM',1,0) AS PM FROM `date_time`) AS FAKE_TABLE_NAME GROUP BY time_stamp
Reply


Messages In This Thread
need sql query output like this - by kvanaraj - 10-05-2018, 09:42 PM
RE: need sql query output like this - by jreklund - 10-06-2018, 02:49 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.