January 11, 2011 at 12:39 pm
Hi,
i have one temp table with id. i need to take records from two select statement with Union for same id
how can i take it.
for ex
#temp table i have 100 id
select A,B, '' as C from table1
where id= id from temp table
Union
select '' A, '' B, C from table 2
where id= id from temp table
for all 100 records
January 12, 2011 at 7:55 am
Are you doing this in SSIS?
Can't you just execute the SQL statement you have in an Execute SQL Task?
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
January 12, 2011 at 8:03 am
What are you doing with the records after the UNION?
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
January 13, 2011 at 8:29 am
Try this:
select A,B, '' as C from table1
where id in (select id from temp table)
Union
select A, B, C from table 2
where id in (select id from temp table)
January 19, 2011 at 5:21 pm
i am trying to merge the colums which is taken from two queries.
January 19, 2011 at 11:28 pm
pmckarur (1/19/2011)
i am trying to merge the colums which is taken from two queries.
As said before, can't you just execute a TSQL UNION statement in an Execute SQL Task?
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply