Page 1 of 1

Query Problem

Posted: Mon Apr 27, 2009 8:38 am
by itsmani1
Hello,

I am having a query problem. this query is not returning correct tm value.

It returns tm value of row one with row two etc. I think I need to put a condition where it calculate tm with correct row but i don't know how can i do this.

Here is query
select TIME_FORMAT(TIMEDIFF(now(),p.created),'%H')as tm, p.price from prices p where p.FK_STATION_ID in (1,2,3) and p.FK_CITY_ID in (1,2,20,4,5,6,7,8) and p.created > DATE_ADD(now() ,INTERVAL -24 hour) order by p.PK_ID desc
Thanks.