SQLTeam.com | Weblogs | Forums

Do not display Row_Number() OVER column


#1

Hello,
I have a query where I am trying to get only the first record for a field that has the same value for multiple records. I am using Row_Number OVER(), and the query is working fine but it displays the Row number column in the result set. How do I avoid displaying that row number column?

Thanks.


#2

Show us the query.


#3

I do not want row number column to be shown in the result set from this query, thanks.

WITH _table AS
(SELECT DISTINCT *
FROM tblA
)
SELECT * FROM
(SELECT
a.*, ROW_NUMBER() OVER(PARTITION BY a.BondNum ORDER BY a.BondNum ) AS freq
FROM tblA a)X
WHERE freq = 1


#4

Then change your SELECT * to only the columns that you want.


#5

Thanks Tara, why didn't I think of it? because I do not have ability to think. Thanks for your time.