Postgresql rows to columns (UNION ALL to JOIN) -


hello query i'm getting 1 result 4 rows, how can change in order 4 named columns own result every one?

select count(*) vehicles cus=1 union select count(*) user cus=1 union select count(*) vehicle_events cus=1 union select count(*) vehicle_alerts cus=1 

thanks in advance.

select a.ct veh_count, b.ct user_count, c.ct event_count, d.ct alert_count ( select count(*) ct vehicles cus=1 ) a, ( select count(*) ct user cus=1 ) b, ( select count(*) ct vehicle_events cus=1 ) c, ( select count(*) ct vehicle_alerts cus=1 ) d; 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -