t-sql grouping query

Posted by stackoverflowuser on Stack Overflow See other posts from Stack Overflow or by stackoverflowuser
Published on 2010-04-16T18:07:21Z Indexed on 2010/04/16 18:13 UTC
Read the original article Hit count: 360

Filed under:
|
|

Hi

based on the following table

Name
---------
A
A
A
B
B
C
C
C

I want to add another column to this table called 'OnGoing' and the values should alternate for each group of names. There are only two values 'X' and 'Y'. So the table will look like

Name     OnGoing
----------------
A        X
A        X
A        X 
B        Y
B        Y
C        X
C        X 
C        X

how to write such a query that can alternate the values for each group of names.

© Stack Overflow or respective owner

Related posts about tsql

Related posts about sql-server-2005