...

View Full Version : normalized table query



BubikolRamios
03-15-2013, 04:46 AM
name surname car

bill gates bmw
bill gates renault
john doe renault
...


how to find who does not have bmw ?

Old Pedant
03-15-2013, 07:16 AM
??? What does this have to do with Normalization???

There is not such thing as a one-table database that is normalized.

However...


SELECT DISTINCT t1.name, t1.surname, t2.surname AS usedAsFlag
FROM table AS t1
LEFT JOIN ( SELECT name, surname FROM table
WHERE car = 'bmw' ) AS t2
ON t1.name = t2.name
AND t1.surname = t2.surname
HAVING usedAsFlag IS NULL



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum