Question : sql min()

i wanted to find the first ZIp code recorded in a table. I used

SELECT     ID, MIN(BegDat) AS date, Zip
FROM         Add
GROUP BY EntSys, Zip order by 1

the query is not retuning all the recorded values.

Answer : sql min()

this should do:

1:
2:
3:
4:
5:
6:
SELECT *
  FROM ( SELECT ID, BegDate, Zip
              , ROW_NUMBER() OVER (PARTITION BY ID ORDER BY BegDate ASC) rn
           FROM [Add]
       ) sq
 WHERE sq.RN = 1
Random Solutions  
 
programming4us programming4us