mysql - MSQL IF statement Error -


i'm trying retrieve data of multiple parameters table of mysql based database.

i want check count of date , if count equal 24, need find max , min of multiple parameter , retrieve data. i've used below shown query, gives syntax error.

"set @cnt=(select count(date) data id=1111 ,     data_date>='2016-01-24 00:00:00' , data_date<'2016-01-25 00:00:00')    \        if (@cnt=24) \             select min(parameter1),max(parameter2) station_data station_id=6216 , data_date>='2016-01-24 00:00:00' , data_date<'2016-01-25 00:00:00' \      end if 

but gives syntax error . i'm mysql beginner , highly appreciated.

thanks in advance.

if statements different in queries. please use following query:

set @cnt=(select count(date) data id = 1111         , data_date >= '2016-01-24 00:00:00'         , data_date < '2016-01-25 00:00:00');  select if(@cnt = 24, min(parameter1), '')  parameter1,        if(@cnt = 24, max(parameter2), '')  parameter2         station_data station_id = 6216         , data_date >= '2016-01-24 00:00:00'         , data_date <  '2016-01-25 00:00:00'; 

Comments