Re: SQL statement to select from a drupal webform table On 1 May, 10:36, skinhat <skin...@gmail.com> wrote:
> In the following drupal table 'webform_submitted_data' the date
> 12/8/2007 is specified via 3 records ie:
>
> 2 1176718828 0 12
> 2 1176718828 1 8
> 2 1176718828 2 2007
>
> I need to be able to select a sid that value matches a certain date.
> In the above example the sid value would be '2' if I wanted to select
> with date '12/8/2007'. I was wondering if there was a mysql (4.1.21-
> standard) SQL statement I could use select all the distinct sid values
> that match a certain date. The following is an example of a
> 'webform_submitted_data' table:
>
> sid cid no data
> 2 1176015743 0 ali...@mailaby.com
> 2 1176015500 0 alison
> 2 1176015691 0 money
> 2 1176718828 0 12
> 2 1176718828 1 18
> 2 1176718828 2 2007
> 2 1176851105 0 1
> 2 1176851105 1 8
> 2 1176851105 2 2008
> 2 1177590862 0 Cheapest flights please 7 adt 6 chd
> 3 1176015743 0 ijwuishwe@mnqashiu
> 3 1176015500 0 james
> 3 1176015691 0 hogh
> 3 1176718828 0 4
> 3 1176718828 1 5
> 3 1176718828 2 2008
> 3 1176851105 0 4
> 3 1176851105 1 26
> 3 1176851105 2 2008
> 3 1177590862 0 Cheapest easter seats please
> 4 1176015743 0 jasnbuighe@kjnasiuh
> 4 1176015500 0 david
> 4 1176015691 0 wings
> 4 1176718828 0 12
> 4 1176718828 1 8
> 4 1176718828 2 2007
> 4 1176851105 0 12
>
> This is a drupal table and I would prefer not modify the structure of
> it.
SELECT
DISTINCT `sid`
WHERE LEFT(FROM_UNIXTIME(`cid`),10) = '2007-12-08'; |