December 26, 2013 at 12:41 am
in my database ....i have four tables ....every table have mobile coloum ..........
i want o/p like FOUR table mobile field MERGE in newtable ......
ex-
table 'a'
name mobile
raju 9876523422
vamshi 9676768200
table 'b'
name mobile
cas 9876523987
saxsc 9347543211
table 'c'
name mobile
ramu 9875429000
fgdhj 9856432111
table 'd'
name mobile
asv 9834256234
shash 9867598765
i want table a,b,c,d mobile coloum data merge in newtable ....ouput like below table......
Mobile
9876523422
9676768200
9876523987
9347543211
9834256234
9867598765
9875429000
9856432111
December 26, 2013 at 6:02 am
shashianireddy 30786 (12/26/2013)
in my database ....i have four tables ....every table have mobile coloum ..........i want o/p like FOUR table mobile field MERGE in newtable ......
ex-
table 'a'
name mobile
raju 9876523422
vamshi 9676768200
table 'b'
name mobile
cas 9876523987
saxsc 9347543211
table 'c'
name mobile
ramu 9875429000
fgdhj 9856432111
table 'd'
name mobile
asv 9834256234
shash 9867598765
i want table a,b,c,d mobile coloum data merge in newtable ....ouput like below table......
Mobile
9876523422
9676768200
9876523987
9347543211
9834256234
9867598765
9875429000
9856432111
This would just be multiple SELECTs separated by UNION or UNION ALL depending on whether or not you wanted distinct values.
--Jeff Moden
Change is inevitable... Change for the better is not.
December 26, 2013 at 9:28 am
INSERT INTO NewTable(name,mobile)
SELECT name,mobile from a UNION ALL
SELECT name,mobile from b UNION ALL
SELECT name,mobile from c UNION ALL
SELECT name,mobile from d
Lowell
December 26, 2013 at 9:50 am
For Distinct try like this.
select a.Number INTO One_Column FROM
(select Number from Merge_Columns
UNION
select Number from Merge_Columns1
)a
For whole data from both table try like below.
select a.Number INTO One_Column FROM
(select Number from Merge_Columns
UNION ALL
select Number from Merge_Columns1
)a
Hope this helps.
Thanks:)
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply