Welcome Guest, Not a member yet? Register   Sign In
count(case) not working. how to resolve it.
#1

(This post was last modified: 10-30-2018, 09:13 PM by kvanaraj.)

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




Theme © iAndrew 2016 - Forum software by © MyBB