Tushal Bhanderi Tushal Bhanderi - 11 months ago 56
MySQL Question

how to join two table in database

I want query for join two table in single other table.

PhpMyadmin database

Table One

c_id name
a 1
b 2
c .
d 4

Table Two

m_id name
a 1
b 2
c .
d 4
e .
f .

One and Two Joined

c_id m_id name
a a
a b
a c
b a
b b
b c

i want help to join two table ..(i think Wordpress store data in this kind of format, it uses few tables and store any number field related to post/category within those tables).any help/idea to solve this problem would be appreciated.).

Answer Source

If you're looking to JOIN them in a SELECT query (as in, extract data but not change existing data in the database) then you could do a simple join query with this structure:

FROM tableA a
    JOIN tableB b ON a.id = b.a_id