4 つのテーブルからデータを取得しようとしています。
- users_profile
- 友達リスト
- bs_items
- bs.photos
ユーザーの友人がアップロードした製品を取得しようとしています。そのために、次のクエリを作成しました
select F.friend_id,F.status,F.uid, b.owner_id,b.price, b.currency,
b.item_name,b.item_id,bs.productId,bs.userId,bs.photo_thumb,u.uid,u.fname,
u.lname, u.profile_pic
from bs_items b,bs_photos bs,friend_list F,users_profile u
where F.status=1 and F.uid='5' and U.uid=F.friend_id
and b.owner_id=F.friend_id
and b.item_id=bs.productId and b.owner_id=bs.userId
order by b.timestamp desc
しかし、上記のクエリは私に望んでいた結果を与えていますが、それらを繰り返しています。たとえば、製品をアップロードした友人が 1 人いて、レコードがフェッチされ、それが 5 回繰り返されます。誰でもこれで私を助けることができますか?