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
 How to split to dropdown

Author  Topic 

rajar32
Starting Member

1 Post

Posted - 2008-10-26 : 06:56:56
My doubt, is i want dis to load seperately in d dropdown, dis is query loading all d records in a single line in d drpdown list . am using asp.net C# web apllication .

select distinct fid,(select distinct fname from foodtable where
fid=maintable.fid)as fname,stuff( (select ','+resname from resttable where rid = maintable.rid for xml path('')),1,1,'') as resname from maintable


I want the resname records to load in dropdown individually, basically speaking, i need to split the multiple records to a singe records...



rajar
C#.dot programmer

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-26 : 07:14:15
did you mean this

select distinct m.fid,f.fname,r.resname
from maintable m
inner join (select distinct fname from foodtable) f
on f.fid=m.fid
inner join resttable r
on r.rid = m.rid
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-10-29 : 04:20:20
Also try

select m.fid,f.fname,r.resname
from maintable m
inner join foodtable f
on f.fid=m.fid
inner join resttable r
on r.rid = m.rid


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -