Monday, March 26, 2012

populate ddl from two tables

Hello,
I have two Tables: Table1: GroupID1, GroupName1 and Table2:GroupID2,
GroupName2.
I have only one dropdown list (DropDownList1) in my application and through
a stored procedure I want to populate my DropDownList1 from GroupName1 and
GroupName2. How should I write my query?
Thanks,
Jim.You'll probably want to use a union.
select companyname from suppliers union select shipcity from orders
try this on Northwind, it'll return the companynames and shipcity in one
long list.
HTH
Pete
--
http://www.xboxracing.net/
"JIM.H." wrote:

> Hello,
> I have two Tables: Table1: GroupID1, GroupName1 and Table2:GroupID2,
> GroupName2.
> I have only one dropdown list (DropDownList1) in my application and throug
h
> a stored procedure I want to populate my DropDownList1 from GroupName1 and
> GroupName2. How should I write my query?
> Thanks,
> Jim.
>
Jim,
You need to join 2 tables with a UNION query.
Eliyahu
"JIM.H." <JIMH@.discussions.microsoft.com> wrote in message
news:318E29E9-6546-43E0-9B65-C0529E58FA96@.microsoft.com...
> Hello,
> I have two Tables: Table1: GroupID1, GroupName1 and Table2:GroupID2,
> GroupName2.
> I have only one dropdown list (DropDownList1) in my application and
through
> a stored procedure I want to populate my DropDownList1 from GroupName1 and
> GroupName2. How should I write my query?
> Thanks,
> Jim.
>
Can you give me an example?
"Eliyahu Goldin" wrote:

> Jim,
> You need to join 2 tables with a UNION query.
> Eliyahu
> "JIM.H." <JIMH@.discussions.microsoft.com> wrote in message
> news:318E29E9-6546-43E0-9B65-C0529E58FA96@.microsoft.com...
> through
>
>

0 comments:

Post a Comment