select pk_id,pk_new_amt
FROM vw_pk_discount,(select @mi:=0 mi,@mx:=0 mx)R
where pk_id in(626,627,628,629,633,634,635) AND
'2013-01-29 10:06:28' BETWEEN pk_start_dt AND pk_end_dt and
(if(@mi<pk_new_amt,(select @mi:=pk_new_amt),0) or
if(@mx>pk_new_amt,(select @mx:=pk_new_amt),0));
to find min,max value using variables, when we use it in coding format,
we are using the variables as assignment operator with the condition checking
FROM vw_pk_discount,(select @mi:=0 mi,@mx:=0 mx)R
where pk_id in(626,627,628,629,633,634,635) AND
'2013-01-29 10:06:28' BETWEEN pk_start_dt AND pk_end_dt and
(if(@mi<pk_new_amt,(select @mi:=pk_new_amt),0) or
if(@mx>pk_new_amt,(select @mx:=pk_new_amt),0));
to find min,max value using variables, when we use it in coding format,
we are using the variables as assignment operator with the condition checking