Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select data from 9 tables to 1 list box 1

Status
Not open for further replies.

skyline666

Programmer
Oct 22, 2007
141
GB
Hi,

I have 9 tables (each with 3 columns) that are all similar to each other. Want I want to be able to do is select the data from the 9 tables (the middle column), and have them all put into one list box. So something like this:

Listbox
Tbl1 MidCol
Tbl1 MidCol
Tbl2 MidCol
Tbl3 MidCol etc

Im not sure if this can be done, I know I could make 9 list boxes and have them one under each other, but I need them in one big list so that they can be selected to be grouped with something else. I tried doing a select statement (select midcol.tbl from tbl) but didnt work.

Any help will be much appreciated,

Andrew
 
Have a look at UNION query.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV, got it sorted with the Union query, here it is:

Code:
SELECT  Corporate3rdParty.Corporate3rdParty as ListName from Corporate3rdParty
union
select CorporateCommercial.CorporateCommercial as ListName from CorporateCommercial
union
select CorporateTechnical.CorporateTechnical as ListName from CorporateTechnical
union
select External3rdParty.External3rdParty as ListName from External3rdParty
union
select ExternalCommercial.ExternalCommercial as ListName from ExternalCommercial
union
select ExternalTechnical.ExternalTechnical as ListName from ExternalTechnical
union
select Project3rdParty.Project3rdParty as ListName from Project3rdParty
union
select ProjectCommercial.ProjectCommercial as ListName from ProjectCommercial
union
select ProjectTechnical.ProjectTechnical as ListName from ProjectTechnical

Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top