March 15, 2010 at 12:31 pm
Does anyone know how I can create Column2 data using SQL?
Column1 Column2
A 1
A 2
B 1
B 2
B 3
C 1
etc. ......
I found a solution that requires the use of ROW_NUMBER() function. But because SQL Server 2000 can't recognize that function, is there another alternative solution to get column2 data? Thanks.
March 15, 2010 at 12:46 pm
I'm not exactly sure what you are trying to accomplish as your sample data is rather vague. If you follow the first link in my signature it will detail exactly what we need in order to help you solve you problem.
As a complete guess based on the information provided you might group by column 1 and column 2 could contain COUNT(*) Or if you only want to see the duplicate rows you could try using a HAVING clause.
Anything more precise will require some more data from you.
Thanks,
-Luke.
March 15, 2010 at 3:16 pm
I have one column with duplicate entries:
Column1
A
A
B
B
B
C
I'd like to create a new column that generates a counter within each duplicate record.
Column1 NewColumn
A 1
A 2
B 1
B 2
B 3
C 1
Is there a way I can do this using SQL or do I need to use a loop function? Thanks.
March 15, 2010 at 3:59 pm
No need for further discussion.
Seems like the question has already been answered here .
Side note: since the solution in the other thread is based on ROW_NUMBER I guess the question was posted on the wrong forum....
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply