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!
Asked
Active
Viewed 51 times
1
-
You can achieve this using `SELECT` statement with `UNION` option between those two tables. (if you use `SQL SERVER` as your back-end) – Balagurunathan Marimuthu Sep 06 '16 at 05:11
-
http://stackoverflow.com/questions/14105265/dropdownlist-datasource/14105600#14105600 – Mohammad Arshad Alam Sep 06 '16 at 05:16
-
Thank you very much, for both of you – Zoe Sep 06 '16 at 06:08
1 Answers
0
SELECT CompanyId, CompanyName FROM table1
UNION ALL
SELECT CompanyId, CompanyName FROM table2
GO
Refer: UNION & UNION ALL Diff.

Community
- 1
- 1

Balagurunathan Marimuthu
- 2,927
- 4
- 31
- 44