Monday, 26 August 2013

Rewriting a query

Rewriting a query

$gettmm = "SELECT min(date_format(lastupdate,'%H:%i')),
max(date_format(lastupdate,'%H:%i')) FROM my_table WHERE
lastupdateid='".$key1."' and
date_format(lastupdate,'%Y-%m-%d')='".$search_date."'";
I need to change the date comparision. I prefer between as shown below.
and lastupdate between ('2013-08-13 00:00:00') and ('2013-08-13 23:59:59') ;
The variable $search_date is 2013-08-13 and I need to concat it with 00
and 23 in order to make it suitable for between clause. How to write the
appropriate PHP code for this.

No comments:

Post a Comment