-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: _SQL_Vinod_
Message 4 in Discussion

Great. Mirnal, there is a small correction here. You dont need to use DISTINCT as a 
UNION would do the distinct operation for you automagically :).

So the same query is much more simplified as:

create table #Parent
(
id int primary key ,
parentname varchar(30)
)

create table #Child
(
childid int ,
parenId Int,
name varchar(30)
)

Insert into #Parent values (1,'hari')
Insert into #Parent values (2,'sam')
Insert into #Parent values (3,'kishan')
Insert into #Parent values (4,'ashok')

Insert into #child values(1,3,'john')
Insert into #child values(2,3,'haris')

Select id , ParentName from #Parent
Union
Select parenID, name from #Child
Order by 1

Sounds fine ???

HTH,
Vinod Kumar
www.ExtremeExperts.com
http://groups.msn.com/SQLBang (Bangalore SQL Server Group)


-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDOTNET/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to