Hi, thank you for the hint.
I used it in my real example but still making some syntax errors:
the tables are:
Classes(class, type, country, numGuns, bore, displacement)
Ships(name, class, launched)
I just need to get a name of a ship meeting at leat 4 criteria....
my query looks like:
SELECT name FROM (SELECT name, classmatch, borematch, displacementmatch, countrymatch, launchedmatch, typematch, numgunsmatch, classmatch + countrymatch + launchedmatch + typematch + displacementmatch + borematch + numgunsmatch as total,
(CASE WHEN class = 'Kongo' THEN 1 ELSE 0 END) as classmatch,
(CASE WHEN country = 'USA' THEN 1 ELSE 0 END) as countrymatch,
(CASE WHEN launched = '1915' THEN 1 ELSE 0 END) as launchedmatch,
(CASE WHEN type = 'bb' THEN 1 ELSE 0 END) as typematch,
(CASE WHEN bore = '15' THEN 1 ELSE 0 END) as borematch,
(CASE WHEN numguns = '8' THEN 1 ELSE 0 END) as numgunsmatch,
(CASE WHEN displacement = '32000' THEN 1 ELSE 0 END) as displacementmatch
FROM ships, classes WHERE ships.name=classes.class AND total>=4)
Do you know what is wrong??
thanks