Oracle 查询返回的值如下例所示。但我想订购联系人姓名为 admin,jack,robert ,但下面的顺序不是按字母顺序排列的,同时 prodid 应该是相同的组,如下例所示。
甲骨文查询:
SELECT part_id, prodname, shippingaddress, contact
FROM part p, address a WHERE p.part_id = a.part_id (+)
AND p.quarter = a.quarter (+) AND
p.quarter = '2014' AND order by p.prod_id
以上查询输出:
prodid prodname shippingaddress contact
-------------------------------------------------
01 computer xxxxxx Jack
01 computer xxxxxx admin
01 computer xxxxxx robert
03 keybord xxxxxx admin
03 keybord xxxxx jack
06 cpu xxxx robert
06 cpu xxxx admin
06 cpu xxx jack
预期输出:
prodid prodname shippingaddress contact
-------------------------------------------------
01 computer xxxxxx admin
01 computer xxxxxx jack
01 computer xxxxxx robert
03 keybord xxxxxx admin
03 keybord xxxxx jack
06 cpu xxxx admin
06 cpu xxxx jack
06 cpu xxx robert
这在 SQL 中可能吗?