mysql データベースに 2 つのテーブル ストアと共有があります。IN句を避けようとしています。詳しくは下記をご覧ください
select id, user_id from stores where user_id =7;
+----+---------+
| id | user_id |
+----+---------+
| 36 | 7 |
| 37 | 7 |
select stores_id,share_id from shares where share_id=7;
+-----------+----------+
| stores_id | share_id |
+-----------+----------+
| 15 | 7 |
| 38 | 7 |
今、私はこれを実行します
SELECT stores.id
FROM stores
WHERE user_id = 7
UNION
(SELECT stores.id
FROM stores
WHERE id IN (SELECT stores_id
FROM shares
WHERE share_id = 7));
以下の結果を得るには:
+----+
| id |
+----+
| 36 |
| 37 |
| 15 |
| 38 |
+----+
質問 INキーワード を使用しないようにクエリを書き直すにはどうすればよいですか?