作者:DilWilling | 来源:互联网 | 2023-05-18 04:32
Iwanttoworkoutthemalefemalesplitofmycustomerbasedonthepersonstitle(Mr,Mrs,etc)我
I want to work out the male/female split of my customer based on the person's title (Mr, Mrs, etc)
我想根据人的头衔(先生,夫人等)计算出我的客户的男/女分手。
To do this I need to combine the result for the Miss/Mrs/Ms into a 'female' field.
要做到这一点,我需要将Miss / Mrs / Ms的结果合并到一个“女性”字段中。
The query below gets the totals per title but I think I need a sub query to return the combined female figure.
下面的查询得到每个标题的总数,但我想我需要一个子查询来返回合并的女性数字。
Any help would be greatly appreciated.
任何帮助将不胜感激。
Query:
SELECT c.Title, COUNT(*) as Count
FROM
Customers c
GROUP BY Title
ORDER By [Count] DESC
Answer:
Mr 1903
Miss 864
Mrs 488
Ms 108
3 个解决方案