View Full Version : normalized table query
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 ?
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.
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
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.