I have 3 select queries:
select
convert(varchar(50),(CONVERT(varchar(50), enq_id) + '/' + CONVERT(varchar(50), YEAR(fy_year)))) as EnqIDFyYear
from
Sample.dbo.enquiry_details
select
A.profile_name
from
profile_profile A, enquiry_details B
where
A.profile_id = B.client_id
select
A.group_name
from
mas_group_type A, enquiry_details B
where
A.group_id = B.group_id
I have created a master table:
create table dbo.UltimateTable
(
ColumnA varchar(max),
ColumnB varchar(max),
ColumnC varchar(max)
)
I want to insert the above 3 select queries in the above UltimateTable
as its 3 columns.
How can this be done?
I tried something as
insert into dbo.UltimateTable(ColumnA)
select
convert(varchar(50),(CONVERT(varchar(50), enq_id) + '/' + CONVERT(varchar(50), YEAR(fy_year)))) as EnqIDFyYear
from
Sample.dbo.enquiry_details
But it lets me insert one at a time, values other than ColumnA become null.
How to insert all the 3 SQL queries at one go?
EDIT: Maybe I should make the question more clear. The results of the above 3 select queries are as follows:
EnqIDFyYear
1/2015
2/2014
profile_name
ProfileA
ProfileB
group_name
GroupA
GroupB
I want to insert them in UltimateTable
like this:
EnqIDFyYear profile_name group_name
1/2015 ProfileA GroupA
2/2014 ProfileB GroupB
Anurag