伙计们,我想从表 articles
中选择,具体取决于 code
是否在名为 inStock
的表中。因此,例如,如果我在表 inStock
224 的列 code
中,我需要选择 * FROM articles
具有该代码并且每个项目都相同。有帮助吗?
这是表格 inStock
这是表 articles
最佳答案
尝试使用以下查询:使用内部联接,您可以获得此代码,因为代码需要出现在两个表中,希望您会得到您想要的答案
select a.id,a.code,a.name,a.description,a.amount,a.color,b.price
from articles a inner join instock b
on a.code=b.code
关于php - 根据另一个表中的存在从表中进行选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51738929/