• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
count(case) not working. how to resolve it.

#1
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.


Attached Files Thumbnail(s)
   
Reply

#2
@kvanaraj,

What table is period in?
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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