CodeIgniter Forums

Full Version: count(case) not working. how to resolve it.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
@kvanaraj,

What table is period in?