I am using Derby.
I have a table with two columns X and Y.
I want to select column X but group by column Y.
This means I want to show only ONE X value for each row with the first Y value to it.
How can I do this?
CREATE TABLE test (
x INTEGER NOT NULL ,
y INTEGER NOT NULL )
INSERT INTO test VALUES (1,1) ,(1,2) ,(1,3) ,(2 ,3),(3,3)
SELECT y FROM test GROUP BY x -- does not work
i want all y values with no duplicate
Raw Data
X Y -- -- 1 1 1 2 1 3 2 3 3 3
The results should be:
X Y -- -- 1 1 1 2 2 3