SQL Query That Should Return Least two days record

Posted by Aryans on Stack Overflow See other posts from Stack Overflow or by Aryans
Published on 2012-04-13T05:05:53Z Indexed on 2012/04/13 5:29 UTC
Read the original article Hit count: 191

Filed under:
|
|

I have a table "abc" where i store timestamp having multiple records let suppose

1334034000  Date:10-April-2012
1334126289  Date:11-April-2012 
1334291399  Date:13-April-2012

I want to build a sql query where I can find at first attempt the records having last two day values and so second time the next two days . . .

Example:

Select *,dayofmonth(FROM_UNIXTIME(i_created)) from notes
where dayofmonth(FROM_UNIXTIME(i_created)) > dayofmonth(FROM_UNIXTIME(i_created)) -2
order by dayofmonth(FROM_UNIXTIME(i_created))

this query returns all the records date wise but we need very most two days record.

Please suggest accordingly. Thanks in advance

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql