Hello all!
Here is what I am trying to do.
I am trying to find only records
that all have the same value for a
specific field in a related table.
A simplified example:
Table1 has 2 fields - id, name
Table2 has 2 fields - id, offon
Given these sets:
Table1
id name
-----------
1 Red
2 Blue
3 Green
Table2
id offon
------------
1 off
1 on
2 on
2 on
3 off
3 off
I want to be able to select
only the Colors that have only
ALL ons relating to them. I
do not want a combination of
off, off or on, off etc...
The only way I have been able
to accomplish this was to count
the number of instances for each
table and save them in temp tables
and then compare the results. There
must be a better way to do this!
Also if anyone would like to recommend
an SQL reference or tutororial I would
love to hear about it.
Thanks in advance.
-Davin
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.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