CodeIgniter Forums
count(case) not working. how to resolve it. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: count(case) not working. how to resolve it. (/showthread.php?tid=72052)



count(case) not working. how to resolve it. - kvanaraj - 10-30-2018

I want count case when value, but it says no field is in the list
Code:
SELECT date(time_stamp) as time_stamp ,
  case when time(time_stamp) between '01:00:00' and '12:00:00' then 'FN' 
       when time(time_stamp) between '12:00:00' and '24:00:00' then 'AN'
  end as period ,b.subject  as subject ,candidates_count count ,a.sheet_no sheetno,if(candidates_count=1,50,if (candidates_count>1,candidates_count*20,'Y') )as amount ,
  if('31'!='31'  ,if(count(period)=2,350,if (count(period)=1,300,'Y') )) as periodcount 
   from table1  a,table2 b,table3 c  
it shows  Unknown column 'period' in 'field list'.  my output should be attached image file.


RE: count(case) not working. how to resolve it. - php_rocs - 10-30-2018

@kvanaraj,

What table is period in?