0
這裏是我的查詢:MySQL的簡單的子查詢/加入
SELECT * From `users` AS `User`
LEFT JOIN `picks` AS `Pick` ON (`Pick`.`User_id` = `User`.`id`)
LEFT JOIN `owners` AS `owner` ON (`owner`.`id` = `Pick`.`owner_id`)
LEFT JOIN `owners_seeds` AS `OwnersSeed` ON (`OwnersSeed`.`ownerdate` = (`owner`.`id`)
LEFT JOIN `labels` AS `Label` ON (`Label`.`id` = `Pick`.`label_id`) WHERE User.market_id = 1111
查詢工作正常,但結果是這樣的:
USER X
PICK X
OWNER X
等。
由於每個用戶都有許多選擇但每個選擇只有一個所有者等等,我想我的結果打印如下:
USER X
- PICK 1
- 所有者1
- 所有者種子
- 所有者2
- 所有者種子
- 奧尼因爲r 3 ...
- 選擇2
等
我怎麼能這樣做?
感謝