A graphic of the db relationship

2005-01-16 Thread Protoculture
Sorry Jochem you were right. Anyway, to get things more concise here, perhaps I'm not even doing the right kind of join... here is my db structure... http://www.webgoblins.net/db.gif The Last Code I tried was Jochems and while it did run succesfully, there were no results returned. Essentially

RE: A graphic of the db relationship

2005-01-16 Thread Michael T. Tangorre
> From: Protoculture [mailto:[EMAIL PROTECTED] > The Last Code I tried was Jochems and while it did run > succesfully, there were no results returned. Essentially What > I'm doing is selecting all related categories from the where > all the ( auction_item_categories_sub.category_id = 1 ) and

RE: A graphic of the db relationship

2005-01-16 Thread Michael T. Tangorre
> From: Michael T. Tangorre [mailto:[EMAIL PROTECTED] I forgot to change something when copy/pasting. SELECT A.name FROM auction_item_categories A INNER JOIN auction_item_categories_sub S1 ON (A.id = S1.category_id) INNER JOIN auction_item_catego

Re: A graphic of the db relationship

2005-01-17 Thread Protoculture
Thanks Mike. I will consider your suggestions about putting all the data into one table. I did have a look at that database you mention and the layout was compelling. However, if the querying would still cause me headaches I would be no further ahead. Behind in fact, because I've had to redesig

RE: A graphic of the db relationship

2005-01-17 Thread Micha Schopman
Why don't you create a many -> many relationship if you want to use multiple categories? Table: auction_item Table: auction_category Table: item_category You only have to use 2 joins here, one join for getting category data, and one for getting category relations. SELECT DISTINCT AI.Label, AC.L

Re: A graphic of the db relationship

2005-01-17 Thread Umer Farooq
Try this.. FROM auction_item_categories AS A INNER JOIN auction_item_categories_sub AS S1 ON A.id = S1.category_id) INNER JOIN auction_item_categories_sub1 AS S2 ON S1.id = S2.category_id) INNER JOIN auction_item_categories_sub2 AS S3 ON S2.id = S3.category_id) INNER JOIN auction_item_cate

Re: A graphic of the db relationship

2005-01-17 Thread Adam Howitt
If you take Jochem's working query that gave no results you should consider changing the INNER JOINs to LEFT JOINs since this will find matching rows in the first table you list and then matching rows from the tables on the right of the LEFT JOIN. If there is no match you see a NULL for any va