![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have captured the cat_id's 30 and 35 with my script, so I need all entry_id's that belong to BOTH cat_id 30 and 35. I tried "Select entry_id from myTable where cat_id = '30' and cat_id = '35' but obviously that is incorrect. |
#3
| |||
| |||
|
|
On Sun, 11 May 2008 08:42:49 -0700, Chuck Cheeze wrote: I have captured the cat_id's 30 and 35 with my script, so I need all entry_id's that belong to BOTH cat_id 30 and 35. I tried "Select entry_id from myTable where cat_id = '30' and cat_id = '35' but obviously that is incorrect. SELECT a.entry_id FROM myTable a INNER JOIN myTable b * * * * ON a.entry_id = b.entry_id WHERE a.cat_id = 30 * * * * AND b.cat_id = 35 -- Remove caps to reply |
#4
| |||
| |||
|
|
On May 11, 10:40 am, PleegWat pleegwat.REM... (AT) CAPS (DOT) telfort.nl.INVALID> wrote: On Sun, 11 May 2008 08:42:49 -0700, Chuck Cheeze wrote: I have captured the cat_id's 30 and 35 with my script, so I need all entry_id's that belong to BOTH cat_id 30 and 35. I tried "Select entry_id from myTable where cat_id = '30' and cat_id = '35' but obviously that is incorrect. SELECT a.entry_id FROM myTable a INNER JOIN myTable b ON a.entry_id = b.entry_id WHERE a.cat_id = 30 AND b.cat_id = 35 -- Remove caps to reply Perfect thanks! |
#5
| |||
| |||
|
|
Chuck Cheeze schreef: On May 11, 10:40 am, PleegWat pleegwat.REM... (AT) CAPS (DOT) telfort.nl.INVALID> wrote: On Sun, 11 May 2008 08:42:49 -0700, Chuck Cheeze wrote: I have captured the cat_id's 30 and 35 with my script, so I need all entry_id's that belong to BOTH cat_id 30 and 35. I tried "Select entry_id from myTable where cat_id = '30' and cat_id = '35' but obviously that is incorrect. SELECT a.entry_id FROM myTable a INNER JOIN myTable b ON a.entry_id = b.entry_id WHERE a.cat_id = 30 AND b.cat_id = 35 -- Remove caps to reply Perfect thanks! Select DISTINCT entry_id from myTable where cat_id = '30' OR cat_id = '35' will also work.... |
![]() |
| Thread Tools | |
| Display Modes | |
| |