December 21, 2011 at 5:31 am
Hi thanks to give the quick response to SSC-Addicted.
if I have like this:
Id Name
------------------
1 sqlserver
2 sqlserver
3 sqlserver
4 server
5 server
6 sql
7 sql
8 sql
9 sql
10 abcde
And I want the output should be
Id Name
------------------
1 sqlserver
4 server
6 sql
10 abcde
Means I want the first occurrence names;:-)
Because I want this for date sorting.
December 21, 2011 at 5:37 am
This is very very basic TSQL and looks like homework. Please read the link in my sig which will show you how best to ask questions and post sample data. Having read it, please post some sample data so that folks can begin immediately on your problem.
Try ROW_NUMBER() OVER(PARTITION BY...ORDER BY). The commonest solutions will require either a derived table or a CTE to filter out the results.
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply