well actually from one table, but two groups of records
The table has ID, NAME, DATA
I need all the records where ID is value1 or ID is value2
BUT … there could be the same name for both values, I only want the one with lowest ID value
- a given name may be in the table with just one id with value1
- a given name may be in the table with just one id with value2
- it could be in the table with BOTH, but I only want the one with value1
Actually it would use “base” to decide…
SELECT id,name,data,0 as base
FROM myTABLE
WHERE id=value1
UNION
SELECT id,name,data,1 as base
FROM myTABLE
WHERE id=value2
a given NAME will be in the table a maximum of twice