MySQL Query 2表无关列

时间:2012-07-24 16:09:49

标签: mysql join

我想查询2个表。

以下是表结构:

常见问题

faq_id | member_id | answer

id | faq_id | owner1 | owner2

我在这里尝试做的是:

SELECT faqs.*, workbasket.* FROM faqs 
INNER JOIN workbasket 
WHERE faqs.member_id = 1
AND workbasekt.owner1 = 1 OR workbasekt.owner2 = 1

1 个答案:

答案 0 :(得分:1)

这样的东西?

SELECT FAQ.*, workers.* FROM FAQ INNER JOIN workers on FAQ.faq_id = workers.faq_id
WHERE FAQ.member_id = 1 AND (workers.owner1 = 1 OR workers.owner2 = 1)

您需要更具描述性,并解释要返回的列,要从中获取信息的表以及这些表应如何连接在一起。