Zoe Zoe - 3 months ago 8
MySQL Question

How to make my combo show data from two tables

I have a MDI C# code that reads and writes in and out of a sql DB. I have a "projects" form that has a "Companies" filed (combo) which should be read from the table companies. Now, for some other reason, I have another table which contains the name of some companies with different nature (and that is why they are in a separate table). Now I am wondering if it would be possible if I can have the company names from both of those tables in my project form. Do I need to changes the companies filed to a Listview? Do I have to change the SQL? I am pretty confused on this one. Can someone help? Please!

Answer
SELECT CompanyId, CompanyName FROM table1
UNION ALL
SELECT CompanyId, CompanyName FROM table2
GO

Refer: UNION & UNION ALL Diff.