Paul Edward Pagente Paul Edward Pagente - 1 month ago 7
MySQL Question

How to merge Columns from 2 Different tables?

I have a table in MYSQL that looks like this (Example.)

enter image description here

Only the

Table 1
and
Table 2
the
table 3
is the output. My Question is how can make the Table 3 output? I mean combine the 2 tables column because i want to display it in
combobox
like this.

enter image description here

I have the code of displaying the data in combobox but my problem is the MySQL command, if you want to here is the code in combobox

Dim mycon As New MySqlConnection("server=localhost;pooling=false;userid=root;password=admin1950;database=inventory")
mycon.Open()
Dim da As New MySqlDataAdapter("This is where the MYSQL Command", mycon)
Dim dt As New DataTable
da.Fill(dt)
ComboBox1.DataSource = dt
ComboBox1.DisplayMember = "Column Name"
ComboBox1.ValueMember = "Column Name"
mycon.Close()


atleast the merge column would have a column name so i can put it in the DisplayMember and ValueMember.

TYSM for help

Answer

Use UNION operator for combining result from more than 1 tables

SELECT column1 FROM table1 
UNION
SELECT column1 FROM table2
Comments