Re: SQL statement to select from a drupal webform table On May 1, 8:49 pm, "J.O. Aho" <u...@example.net> wrote:
> skinhat wrote:
> >> SELECT
> >> DISTINCT `sid`
> >> WHERE LEFT(FROM_UNIXTIME(`cid`),10) = '2007-12-08';
>
> > This wouldnt work because the 'cid' field doesnt hold the date. Its
> > just a unique identifier.
>
> Yes, the cid column does hold the date, it's just in a unixtime format and the
> FROM_UNIXTIME() function would then convert it to a human readable format
>
Notice in the table these records:
2 1176718828 0 12
2 1176718828 1 18
2 1176718828 2 2007
3 1176718828 0 4
3 1176718828 1 5
3 1176718828 2 2008
Both have the same CID yet represent different dates. The first is
12/18/2007 and the second is 4/5/2008. |