当前位置: 动力学知识库 > 问答 > 编程问答 >

MySql How to do a Simple Join

问题描述:

I need to do a SELECT query from a table but only return the results that equal an 'I' in a column from another table?

How is this done?

Something like this but I know my syntax is all wrong:

SELECT * FROM table1

WHERE ITEM_TYPE = 'I' ON table2

网友答案:
SELECT *
FROM table1 t1
JOIN table2 t2
ON t1.id = t2.table1_id
WHERE t2.item_type = 'I'
网友答案:
 SELECT * FROM table1 JOIN table2 ON
table1.id = table2.id WHERE item_type = 'I';
分享给朋友:
您可能感兴趣的文章:
随机阅读: