Unix Technical Forum

SQL statement to select from a drupal webform table

This is a discussion on SQL statement to select from a drupal webform table within the MySQL forums, part of the Database Server Software category; --> > Shucks! Fancy being in awe of little-ole me! > > SELECT > DISTINCT `w1`.`sid` > FROM `webf` `w1` ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 02-28-2008, 09:43 AM
skinhat
 
Posts: n/a
Default Re: SQL statement to select from a drupal webform table


> Shucks! Fancy being in awe of little-ole me!
>
> SELECT
> DISTINCT `w1`.`sid`
> FROM `webf` `w1`
> JOIN `webf` `w2` ON `w2`.`cid` = '1176718828'
> AND `w1`.`sid` = `w2`.`sid`
> AND `w2`.`no` = '2'
> JOIN `webf` `w3` ON `w3`.`cid` = '1176718828'
> AND `w1`.`sid` = `w3`.`sid`
> AND `w3`.`no` = '0'
> JOIN `webf` `w4` ON `w4`.`cid` = '1176718828'
> AND `w1`.`sid` = `w4`.`sid`
> AND `w4`.`no` = '1'
> WHERE `w2`.`data` = '2007'
> AND `w3`.`data` = '12'
> AND `w4`.`data` = '8'


Excellent. Thanks. I don't really get it but it works.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 02-28-2008, 09:43 AM
Captain Paralytic
 
Posts: n/a
Default Re: SQL statement to select from a drupal webform table

On 1 May, 14:09, skinhat <skin...@gmail.com> wrote:
> > Shucks! Fancy being in awe of little-ole me!

>
> > SELECT
> > DISTINCT `w1`.`sid`
> > FROM `webf` `w1`
> > JOIN `webf` `w2` ON `w2`.`cid` = '1176718828'
> > AND `w1`.`sid` = `w2`.`sid`
> > AND `w2`.`no` = '2'
> > JOIN `webf` `w3` ON `w3`.`cid` = '1176718828'
> > AND `w1`.`sid` = `w3`.`sid`
> > AND `w3`.`no` = '0'
> > JOIN `webf` `w4` ON `w4`.`cid` = '1176718828'
> > AND `w1`.`sid` = `w4`.`sid`
> > AND `w4`.`no` = '1'
> > WHERE `w2`.`data` = '2007'
> > AND `w3`.`data` = '12'
> > AND `w4`.`data` = '8'

>
> Excellent. Thanks. I don't really get it but it works.- Hide quoted text -
>
> - Show quoted text -


An opportunity to improve your "good" SQL skills then ;-)
This is really a quite standard use of the JOIN syntax.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 02-28-2008, 09:43 AM
skinhat
 
Posts: n/a
Default Re: SQL statement to select from a drupal webform table

On May 1, 11:15 pm, Captain Paralytic <paul_laut...@yahoo.com> wrote:
> On 1 May, 14:09, skinhat <skin...@gmail.com> wrote:
>
>
>
> > > Shucks! Fancy being in awe of little-ole me!

>
> > > SELECT
> > > DISTINCT `w1`.`sid`
> > > FROM `webf` `w1`
> > > JOIN `webf` `w2` ON `w2`.`cid` = '1176718828'
> > > AND `w1`.`sid` = `w2`.`sid`
> > > AND `w2`.`no` = '2'
> > > JOIN `webf` `w3` ON `w3`.`cid` = '1176718828'
> > > AND `w1`.`sid` = `w3`.`sid`
> > > AND `w3`.`no` = '0'
> > > JOIN `webf` `w4` ON `w4`.`cid` = '1176718828'
> > > AND `w1`.`sid` = `w4`.`sid`
> > > AND `w4`.`no` = '1'
> > > WHERE `w2`.`data` = '2007'
> > > AND `w3`.`data` = '12'
> > > AND `w4`.`data` = '8'

>
> > Excellent. Thanks. I don't really get it but it works.- Hide quoted text -

>
> > - Show quoted text -

>
> An opportunity to improve your "good" SQL skills then ;-)
> This is really a quite standard use of the JOIN syntax.


My mother tells me I'm good at SQL

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 02-28-2008, 09:43 AM
Captain Paralytic
 
Posts: n/a
Default Re: SQL statement to select from a drupal webform table

On 1 May, 14:41, skinhat <skin...@gmail.com> wrote:
> On May 1, 11:15 pm, Captain Paralytic <paul_laut...@yahoo.com> wrote:
>
>
>
>
>
> > On 1 May, 14:09, skinhat <skin...@gmail.com> wrote:

>
> > > > Shucks! Fancy being in awe of little-ole me!

>
> > > > SELECT
> > > > DISTINCT `w1`.`sid`
> > > > FROM `webf` `w1`
> > > > JOIN `webf` `w2` ON `w2`.`cid` = '1176718828'
> > > > AND `w1`.`sid` = `w2`.`sid`
> > > > AND `w2`.`no` = '2'
> > > > JOIN `webf` `w3` ON `w3`.`cid` = '1176718828'
> > > > AND `w1`.`sid` = `w3`.`sid`
> > > > AND `w3`.`no` = '0'
> > > > JOIN `webf` `w4` ON `w4`.`cid` = '1176718828'
> > > > AND `w1`.`sid` = `w4`.`sid`
> > > > AND `w4`.`no` = '1'
> > > > WHERE `w2`.`data` = '2007'
> > > > AND `w3`.`data` = '12'
> > > > AND `w4`.`data` = '8'

>
> > > Excellent. Thanks. I don't really get it but it works.- Hide quoted text -

>
> > > - Show quoted text -

>
> > An opportunity to improve your "good" SQL skills then ;-)
> > This is really a quite standard use of the JOIN syntax.

>
> My mother tells me I'm good at SQL - Hide quoted text -
>
> - Show quoted text -


Ahh mothers, you've got to love 'em.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 02-28-2008, 09:43 AM
Captain Paralytic
 
Posts: n/a
Default Re: SQL statement to select from a drupal webform table

On 1 May, 15:11, Captain Paralytic <paul_laut...@yahoo.com> wrote:
> On 1 May, 14:41, skinhat <skin...@gmail.com> wrote:
>
>
>
>
>
> > On May 1, 11:15 pm, Captain Paralytic <paul_laut...@yahoo.com> wrote:

>
> > > On 1 May, 14:09, skinhat <skin...@gmail.com> wrote:

>
> > > > > Shucks! Fancy being in awe of little-ole me!

>
> > > > > SELECT
> > > > > DISTINCT `w1`.`sid`
> > > > > FROM `webf` `w1`
> > > > > JOIN `webf` `w2` ON `w2`.`cid` = '1176718828'
> > > > > AND `w1`.`sid` = `w2`.`sid`
> > > > > AND `w2`.`no` = '2'
> > > > > JOIN `webf` `w3` ON `w3`.`cid` = '1176718828'
> > > > > AND `w1`.`sid` = `w3`.`sid`
> > > > > AND `w3`.`no` = '0'
> > > > > JOIN `webf` `w4` ON `w4`.`cid` = '1176718828'
> > > > > AND `w1`.`sid` = `w4`.`sid`
> > > > > AND `w4`.`no` = '1'
> > > > > WHERE `w2`.`data` = '2007'
> > > > > AND `w3`.`data` = '12'
> > > > > AND `w4`.`data` = '8'

>
> > > > Excellent. Thanks. I don't really get it but it works.- Hide quoted text -

>
> > > > - Show quoted text -

>
> > > An opportunity to improve your "good" SQL skills then ;-)
> > > This is really a quite standard use of the JOIN syntax.

>
> > My mother tells me I'm good at SQL - Hide quoted text -

>
> > - Show quoted text -

>
> Ahh mothers, you've got to love 'em.- Hide quoted text -
>
> - Show quoted text -


BTW, when I said it was a standard use of the JOIN syntax, I mean't
that it was not as convoluted as the ubiqutious "Strawberry Query"

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:02 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com