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 |
kt
Yak Posting Veteran
88 Posts |
Posted - 2014-08-22 : 15:34:21
|
Hi,the results I have isrank Ord Line DateDel Recpt Item Sup---- ----- ------ ------ ----- ---- ------1 ABC 10 2014-04-23 C041804 zzz 1232 DEF 80 2014-04-14 M041258 zzz 1232 GHI 40 2014-04-14 K041844 zzz 123I want to get only first two because last two it has the same date of 2014-04-14, what can I do?thankskt |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2014-08-22 : 16:25:08
|
[code]SELECT * FROM ( SELECT *, ROW_NUMBER() OVER (PARTITION BY DateDel ORDER BY Ord) AS RN FROM ( YourOriginal Query here ) s1) s2 WHERE RN = 1;[/code] |
|
|
kt
Yak Posting Veteran
88 Posts |
Posted - 2014-08-22 : 16:51:00
|
thanks alot. |
|
|
|
|
|