Advertisement

PostgreSQL Can't Grouping Data

Query in postgresql is slightly different from mysql. That's one of the drawbacks in postgresql in my opinion but the advantage is that it is more reliable in processing big data. One of the problems I got when I first started using postgresql was that I couldn't group data.

For example query 

SELECT MAX(id) AS id
,(array_agg(assignedby))[1] AS assignedby
,(array_agg(duration))[1] AS duration
,(array_agg(missiontype))[1] AS missiontype
FROM mission GROUP BY missiontype

You can't use SELECT *  but you must put column in array_agg one by one
 [1] and this is index of data

Post a Comment

0 Comments