John Davidson
John Davidson

Reputation: 1

Duplicating Data

looking at duplicating data to include a type A and type B

select *
    from [dbo].[dayStats]
    where status in ('IDmon', 'IDtue', 'IDwed', 'IDthu', 'IDfri')
    order by status

currently have around 3000 records.

i need to duplicate each of these records so they include a A and B

for example:

IDmon
IDtue ...

becomes

IDmonA, IDmonB
IDtueA, IDtueB
...

no IDmon / IDtue records to remain

all the other fields are to be duplicated as normal

really struggling to think how i would create such a query / stored procedure

Upvotes: 0

Views: 81

Answers (1)

René Nyffenegger
René Nyffenegger

Reputation: 40499

Not really sure if you're after this?

select
  status & 'A',
  status & 'B',
  other_col_1,
  other_col_2
from
  [dbo].[dayStats]
where status in ('IDmon', 'IDtue', 'IDwed', 'IDthu', 'IDfri')

Upvotes: 1

Related Questions