Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 display record in two table one by one

Author  Topic 

amirs
Constraint Violating Yak Guru

260 Posts

Posted - 2009-04-29 : 00:15:29
hi
i have two table tab1 and tab2 as same colomn name. how to dispaly record of first tab1 and below this table display second table tab2 records as same col name

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-04-29 : 00:30:28
[code]
select *
from tab1
union all
select *
from tab2
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

amirs
Constraint Violating Yak Guru

260 Posts

Posted - 2009-04-29 : 00:37:49
thanks to replay
but i have display another results
suppose
tab1
name age bdate
a 20 12-10-1989
b 30 12-10-1979
c 10 12-01-1999

tab2

name age bdate
e 15 12-10-1994
f 25 12-10-1984
g 35 12-01-1974


i have display records
name age bdate
a 20 12-10-1989
b 30 12-10-1979
c 10 12-01-1999
e 15 12-10-1994
f 25 12-10-1984
g 35 12-01-1974


Go to Top of Page

aprichard
Yak Posting Veteran

62 Posts

Posted - 2009-04-29 : 00:43:24
You try it

SELECT Name, Age, BDate FROM Table1
UNION ALL
SELECT Name, Age, BDate FROM Table2
ORDER BY Name


Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-04-29 : 00:44:13
what is the expected result ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

amirs
Constraint Violating Yak Guru

260 Posts

Posted - 2009-04-29 : 01:11:58
thanks to all
i use union all and dispay correct results
Go to Top of Page
   

- Advertisement -