This may sound like a strange question but I am trying to use the distinct clause in order to get all the names in a database however I want the first name to be unique
Table structure
id fname lname haircolor 1 john doe brown 2 bob seagal blonde 3 kevin smith red 4 bob doe green
Desired output
john doe brown bob seagal blonde kevin smith red
I have tried
SELECT fname, lname, haircolor
FROM MainTable
INNER JOIN (select distinct frame from MainTable) as Names
ON MainTable.fname=Names.fname
This has not worked. Any help would be greatly appreciated.
Try using
GROUP BYinstead: