Help crafting an SELECT

2006-01-11 Thread Mike Martin
Hi List! Please forgive me if I'm asking the wrong list (and please guide me to the right place). I have two tables (simplified for this example) pics and tags like so: pics: picid photo 1Mustang 2Apple 3Rock 4Beetle tags: tagid picidtag 11 Car 21

Re: Help crafting an SELECT

2006-01-11 Thread SGreen
[EMAIL PROTECTED] wrote on 01/11/2006 02:42:27 PM: Hi List! Please forgive me if I'm asking the wrong list (and please guide me to the right place). I have two tables (simplified for this example) pics and tags like so: pics: picid photo 1Mustang 2Apple 3Rock 4

Re: Help crafting an SELECT

2006-01-11 Thread Peter Brawley
Mike, You're in the right place. If I understand your requirement correctly, you want entries which... match on id, match a selection from ('Mustang' or 'Beetle'), match multiple values in tags (eg 'red' and 'car'). Here's one solution: SELECT p.photo, t.tag FROM pics p INNER JOIN tags c

Re: Help crafting an SELECT

2006-01-11 Thread Mike Martin
On 1/11/06, Gordon Bruce [EMAIL PROTECTED] wrote: I assume you are looking for both red and car. You can not use IN because that is implicitly an IN. You hae to join the tags table to itself using 2 different aliasis. {If you required 3 things then you would join it 3 times etc..} SELECT *

Re: Help crafting an SELECT

2006-01-11 Thread SGreen
[EMAIL PROTECTED] wrote on 01/11/2006 03:53:26 PM: On 1/11/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote on 01/11/2006 02:42:27 PM: Hi List! Please forgive me if I'm asking the wrong list (and please guide me to the right place). I have