April 27, 2011 at 5:01 am
An Alternative for Distinct AND GROUP BY using row_number()
How can I generate distinct values from table without using Distinct and GROUP BY
example
Column1Column2 Column3
123
143
163
231
251
Result SET
Column1
1
2
April 27, 2011 at 5:41 am
Hi,
why don't you want to use DISTINCT or GROUP BY?
/Markus
April 27, 2011 at 5:45 am
Yes I got the solution !!
SELECT Column1
FROM
(SELECT ROW_NUMBER() OVER (PARTITION BY Column1 ORDER BY Column1) As RNO, Column1
from
<Table_Name>)A WHERE RNO = 1
April 27, 2011 at 6:09 am
ASFSDJG (4/27/2011)
Yes I got the solution !!SELECT Column1
FROM
(SELECT ROW_NUMBER() OVER (PARTITION BY Column1 ORDER BY Column1) As RNO, Column1
from
<Table_Name>)A WHERE RNO = 1
Here's another solution.
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]
May 17, 2011 at 2:07 pm
Awesome solution, this really worked!!!:-):-):-):-):-):-D
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy