|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Can an intermediate table exclude records in a join?
Using MySQL, I would like to select records from a table (Products w/ the field ProductNumber) and join all records from another table (Features w/ the field FeatureNumber) unless those feature records appear in a third table (Exclude w/ the fields ProductNumber, FeatureNumber) Is this possible, and what would be the appropriate syntax.
|
|
#2
|
|||
|
|||
|
RE: Can an intermediate table exclude records in a join?
The easiest way I can think of is to left join to the table that excludes rows and then use 'having field is null' at the end. This will only keep rows that didn't match the third table.
Sorry I can't tell you more, can't stay today. |
|
#3
|
||||
|
||||
|
RE: Can an intermediate table exclude records in a join?
I think vertigo has the right idea, but HAVING statements are only usful for GROUP BY clauses. Try something like this:
Code:
SELECT * FROM features AS f INNER JOIN products AS p ON f.product_number=p.product_number LEFT JOIN exclude AS e ON e.product_number=f.product_number AND e.feature_number=f.feature_number WHERE e.feature_number IS NULL |
|
#4
|
|||
|
|||
|
RE: Can an intermediate table exclude records in a join?
Honcho's is better, rather leave 'having' for when you need to use it.
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > Can an intermediate table exclude records in a join? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|