SomeUser
SomeUser

Reputation: 2041

Mysql how to do this?

I need to select records from table,but one field(id2 as example) replace with value from other table with id==id2 from first table

Upvotes: 0

Views: 55

Answers (1)

Marius
Marius

Reputation: 58921

If you want to SELECT the rows from a table where a column value is present in another tables column, then you need to use JOIN:

SELECT * FROM table1 INNER JOIN table2 ON table1.id = table2.id2

Read this blog post by Jeff Atwood on the different joins.

Upvotes: 1

Related Questions