我想选择按订单数量分组的客户数量。结果应该是这样的:
use HTML::HTMLDoc;
my $htmldoc = new HTML::HTMLDoc;
$htmldoc->set_html_content(<<"EOF");
<html><body>
This is my <b>pdf</b>...
</body></html>
EOF
$htmldoc->set_bodyimage('bg.png');
print $htmldoc->generate_pdf()->to_string();
我不知道该怎么做
Number of Orders | Numbers of Customers
---------------------------------------
1 | 29
2 | 16
3 | 23
4 | 26
....
感谢您的帮助。
答案 0 :(得分:0)
如果我理解正确的话:
SELECT s.num_of_orders,count(*) as num_of_customers
FROM(
SELECT count(*) as num_of_orders
FROM Orders o
GROUP BY o.customer_id) s
GROUP BY s.num_of_orders