这是我的查询:
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
ETC..
由于每个用户都有很多选择,但每个选择只有一个所有者等等,我希望我的结果打印如下:
用户 X
- 选择 1
- 所有者 1
- 所有者种子
- 所有者 2
- 所有者种子
- 业主 3...
- 选择 2
ETC
我怎样才能做到这一点?
谢谢