我如何优化这样的三重连接查询
select users.id_user from users,sales,specSales where users.id_user=sales.id_user AND sales.id_sale=specSales.id_sale AND specSales.id_article=34 group by id_user
我想要购买由 id_article=X 标识的产品的不同用户
我已经想到了这一点,但我不确定改进
select id_user from (select distinct(sales.id_user) from sales,specSales where sales.id_sale=specordine.id_sale and specSale.id_article=34)as t
表是(*=主键)
users
*id_user | name | ....
sales
*id_sale | id_user | .... other values
salesSpec
id_sale | id_article | .... other values
非常感谢