I have the following table Employee and records as follows:
Eid Ename Phone
------------------------
1 A 043
1 A 067
2 B 073
2 B 072
3 C 753
3 C 464
What I've got so far:
SELECT *
FROM (SELECT Row_number() OVER (ORDER BY Eid ASC) AS rownum,
Eid,
Ename,
Phone
FROM Employee
WHERE Eid IN(SELECT DISTINCT(Eid)
FROM Employee
GROUP BY Eid)) AS RESULTSET
WHERE rownum BETWEEN 0 AND 3
Actually the inner query is returning the distinct
results but it is not reflected when I am getting the result in final RESULTSET
.
Please advise on how to get the distinct RESULTSET. My output should return like below:
Eid Ename Phone
------------------------
1 A 043
2 B 073
3 C 753