[Qgis-user] qgis/postgis : flow map

Casper Bertelsen casperbj94 at gmail.com
Sat Feb 3 23:29:32 PST 2018


To understand you correct:

In your raw-data table entrants you have one row for each person and in 
your query you want one flow for each person, ie. the same number of 
rows in your output?

In the regards to the group by, you want the sum(ipondi) on each flow 
where they're grouped by a specific field?

Is the above understood correctly?

(The way aggregates work is that you need to group by all 
non-aggregrate, so it will find all unique combinations of the other 
fields in the query and sum based on those.)

Mvh. / Best regards
Casper Bertelsen

Mail: casperbj94 at gmail.com

On 03-02-2018 21:07, image wrote:
> So, i succeed in executing the query without error message. The query
> generates a temp postgis layer linear.
> I attach the SS below showing the qgis canvas
>
> <http://osgeo-org.1560.x6.nabble.com/file/t365144/6.jpg>
>
> But i have always a problem regarding the GROUP BY...i would like to do a
> GROUP BY one field only...but i can't generate the query without put all
> fields present in SELECT into GROUP BY !
>
> Please read my currently query :
>
> create table temp as select
> st_makeline(st_makepoint(entrants_v2.x_resi,entrants_v2.y_resi),st_makepoint(entrants_v2.x_tr,entrants_v2.y_tr))as
> geometry,sum(entrants_v2.ipondi) as sumipondi, entrants_v2.codgeo_res as
> codgeo_res, entrants_v2.codgeo_tr as codgeo_tr
>
> from entrants_v2
> group by
> entrants_v2.codgeo_res,entrants_v2.x_resi,entrants_v2.y_resi,entrants_v2.x_tr,entrants_v2.y_tr,entrants_v2.ipondi,entrants_v2.codgeo_tr
>
> Is it a way to assign one field into group by with postgis? Because my
> result is false.
> In advance, thank you very much.
>
>
>
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-User-f4125267.html
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20180204/4f362998/attachment.html>


More information about the Qgis-user mailing list