looking at dupli开发者_JAVA百科cating 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
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')
精彩评论