[thelist] SQL question

Kevin Sedgley kevin at topophilia.co.uk
Mon May 1 10:20:08 CDT 2006

Hello list,

This is probably blindingly simple but my brain isn't working on this lovely
sunny bank holiday.

I have a table with the following data:

| category | path     |
| cheese   | /cheese  |
| cheddar  | /cheddar |
| stilton  | /stilton |
| cheese   | /cheddar |
| cheese   | /stilton |

(both category and path are primary keys)

If I wanted to search for a path where category is "stilton" and for the
same path the category "cheese" (so the result would be /stilton) is this
possible just using SQL? I'm using MySQL so I can use proprietary commands
if need be.

I was thinking something like SELECT * FROM categories, categories WHERE
category = "cheese" AND category = "stilton" (so combining the same table
twice) but this isn't allowed.

Thanks for your time,


Topophilia Web Services
The TechnoCentre
Coventry University Technology Park

phone: 02476 100011
fax: 0871 661 6815

More information about the thelist mailing list