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` ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| > 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. |
| |||
| 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. |
| |||
| 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 |
| |||
| 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 > > - Show quoted text - Ahh mothers, you've got to love 'em. |
| ||||
| 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 > > > - 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" |