我正在尝试为同一设备获取不同的eSignDeviceCode
但是对于每个eSignDeviceCode
我都会获得一个新行。
select
count(distinct(eSignDeviceCode)) as units,
(f.devicename) as devicename,
(CASE WHEN u.Status=1 THEN count(u.Status) ELSE 0 END) AS intit,
(CASE WHEN u.Status=2 THEN count(u.Status) ELSE 0 END) AS ekyc,
(CASE WHEN u.Status=4 THEN count(u.Status) ELSE 0 END) AS esign
from applicationdetails u
left join esignlogs e
on e.ApplicationSlNo=u.SlNo
LEFT JOIN fingerprintdevice AS f
ON f.SlNo=e.DeviceId group by e.eSignDeviceCode;
答案 0 :(得分:1)
您的group by子句错了。试试这个: -
INSERT INTO sendMsg (Type,Name,SenderName,Message)
SELECT 4, "name" ,'Mike','Hi, blabla' FROM anothertable
-- WHERE ....