Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
ersantosh1
Starting Member
6 Posts |
Posted - 2012-10-08 : 06:39:38
|
i have data in table like:-A B_name C_REM D_s_id E_Z_id F_time1 XX YY 12345 7890 12:30:302 XX YY 12345 7890 12:30:303 XX YY 88888 2222 12:30:304 XX YY 88888 2222 12:30:30i record 1 and 3 record by distinct them as D_s_id and E_Z_IDplz help thankssantoshsrahangdale |
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-10-08 : 06:48:02
|
[code]SELECT * FROM ( SELECT *, ROW_NUMBER() OVER (PARTITION BY D_s_id,E_Z_id ORDER BY A DESC) AS RN FROM YourTable) sWHERE RN=1[/code] |
|
|
|
|
|