我将计算总区域的记录,其中状态会有所不同,例如'PENDING','SENT INFO','PTP',分组查询和多个选择查询,但结果没有得到所以请帮助我。
我的查询是:
SELECT AREA,
(SELECT COUNT( * ) FROM prospectmaster WHERE ZONE = 'AHMEDABAD' && STATUS = 'PENDING' GROUP BY AREA) AS PENDING,
(SELECT COUNT( * ) FROM prospectmaster WHERE ZONE = 'AHMEDABAD' && STATUS = 'SENT INFO.' GROUP BY AREA) AS CNT
FROM prospectmaster
WHERE ZONE = 'AHMEDABAD' GROUP BY AREA
我想要这种类型的结果。
AREA PENDING INFO SENT PTP
AHMEDABAD 1 2 1
GANDHINAGAR 1 5 4
KHEDA 3 10 9
我认为查询中有问题,但我不明白。所以,请帮助我。