Hi,
I have 2 Tables one with the data (lets call the Table Data) and one with Category
information (let's call it Category). I have a third Table (dat2cat)
with FK_Data and FK_Category that i use to assign up to n categorys to each Dataset in
Data.
I now want to get a list of datasets with just on datafield with a Unique index on it
(lets call it name) from Data that have a certain combination of Categorys (And
connected). Normaly i would use
Subquerys but since mySql dont support them i have tried following Query:
select data.name from data, dat2cat where data.pk_data =
dat2cat.fk_data and (dat2cat.fk_category=44 or dat2cat.fk_category = 18)
having count(data.name) 1;
( In this example i used just two categorys (Key 44 and 18) when i use more i would
put mor 'or' statements in and adjust the having clause)
This works fine when there are Results but when there shouldn't be Results i get bacj
the first dataset of the Query without the having clause. (That seems rather strange
to me ;-) )
Do anyone know what is my error ord knows someone a better way to solve this task (i
would like to avoid the usage of temporary tables)
Thanks in Advance
Simon
mail2web - Check your email from the web at
http://mail2web.com/ .
-
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php