I have two tables First one with Status, deviceSerial columns.Status be in (1,2,3,4,5). I want to get the result as count of status
for example device one want to get how many records in status 1, status 2, status 3, status 4, status 5 in a single row
here is my first table
here is my second table
I want to get these records to result as
Here is the code I tried
Select "deviceSerial", (select count("statusId")as Permitted from public.scan_track
where "statusId" = 1 group by "statusId"),
(select count("statusId")as IssuedToday from public.scan_track
where "statusId" = 2 group by "statusId"),
(select count("statusId")as PaidForParking from public.scan_track
where "statusId" = 3 group by "statusId"),
(select count("statusId")as InvalidVehicle from public.scan_track
where "statusId" = 4 group by "statusId"),
(select count("statusId")as ExpiredOrNotPaid from public.scan_track
where "statusId" = 5 group by "statusId"),
(select count("statusId")as Failed from public.scan_track
where "statusId" = 6 group by "statusId"),
(select count("statusId")as Other from public.scan_track
where "statusId" = 7 group by "statusId")
from public.scan_track
group by "deviceSerial"
what is the mistake I have done in this problem,please help me


