有人可以指导我如何获得此查询的答案计数?得到以下查询的答案的计数
SELECT wo.Client_id
FROM wish_order wo,
wish_order_fruit wof
WHERE wo.wish_order_id = wof.wish_order_id
GROUP BY wof.wish_order_id
HAVING Count(wo.Client_id) > 1;
有人可以指导我如何获得此查询的答案计数?得到以下查询的答案的计数
SELECT wo.Client_id
FROM wish_order wo,
wish_order_fruit wof
WHERE wo.wish_order_id = wof.wish_order_id
GROUP BY wof.wish_order_id
HAVING Count(wo.Client_id) > 1;
使用派生表通过查询
select count(*) from (
select wo.Client_id
from wish_order wo, wish_order_fruit wof
where wo.wish_order_id = wof.wish_order_id
Group by wof.wish_order_id
having Count(wo.Client_id) >1
) t1
非常感谢.....它工作!但是,你可以请什么t1代表? – user3693592 2014-11-02 19:58:53
@ user3693592它是派生表的名称 – FuzzyTree 2014-11-02 20:24:17
这是很难告诉你要怎样做才能获得该组返回的行#。您以难以理解的方式使用“GROUP BY”。你能澄清你的问题吗? – 2014-11-02 19:42:16
的这个查询的答案如下: – user3693592 2014-11-02 19:49:49
CLIENT_ID ________ \t 我需要这个答案的数量。 – user3693592 2014-11-02 19:53:25