a query return with some identical rows,
how can I distinguish them?
what I want is like this:
select rowid, column1, column2 from mytable
TIA
Mark Rae [MVP] - 13 Aug 2007 10:22 GMT
>a query return with some identical rows,
> how can I distinguish them?
[quoted text clipped - 4 lines]
>
> TIA
select DISTINCT rowid, column1, column2 from mytable

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
Ladislav Mrnka - 13 Aug 2007 10:30 GMT
Hi,
if you would like to distinguish between two identical rows you have to
change your query to use some row numbering. SQL 2005 provides you mechanism
to do that:
select
NumberedTable.*
from
(
select
column1, column2,
ROW_NUMBER() over (order by column1, column2) as RowNum
from myTable
) NumberedTable
If you do not use SQL 2005 you have to create temporary table with one more
identity column and first fill this table with your date and after that
select that data from this table.
There is still question if your identical rows will always be in same order
but who knows? :)
Regards,
Ladislav
> a query return with some identical rows,
> how can I distinguish them?
[quoted text clipped - 4 lines]
>
> TIA