<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Try use DB Manager (QGIS Plugin - Comes with standard installation
    of QGIS), here you can connect to the database and run queries and
    afterwards import the queries into QGIS.<br>
    <br>
    When you've create a link to your database in "Add PostGIS-layers"
    (Ctrl + Shift + D) it should show up in DB manager :) Here it'll be
    able to read the postgis-functions in the database.<br>
    <br>
    Hope it helps.<br>
    <div class="moz-signature"><font face="Tahoma"> <br>
        Mvh. / Best regards</font><br>
      <div class="moz-signature"><font face="Tahoma"> </font><font
          face="Tahoma">Casper Bertelsen</font><font face="Tahoma"><br>
          <br>
          Mail: <a class="moz-txt-link-abbreviated" href="mailto:casperbj94@gmail.com">casperbj94@gmail.com</a></font><br>
        <div class="moz-signature"><font face="Tahoma"> <br>
          </font></div>
      </div>
    </div>
    <div class="moz-cite-prefix">On 03-02-2018 14:06, image wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:1517663172836-0.post@n6.nabble.com">
      <pre wrap="">Good morning,

I have to do flow map (home->working place) for my area of interest (28
french cities). 
I get a database .dbf created by a french institute. I imported it into
postgres/postgis.
One row = 1 people. 
My table is composed by several fields : 
id (primary key)
codgeo_res: residence (home) city 's id
x_resi: residence (home) city 's longitude(centroid)
y_resi : residence (home) city 's latitude(centroid)
codgeo_tr : work place city 's id
x_tr: work city 's longitude(centroid)
y_tr :work city 's latitude(centroid)
ipondi : poids de l'individu (weighting value assigned to each individual du
to the sampling)
geom : residence (home) city 's ponctual geometry (centroid)


So my goal is to create a new table in order 1 row = 1 flow (city A toward
city B)
I have to generate useful  geometries (points + lines arrow). Moreover, have
to apply a SUM on the ipondi field and a GROUP BY on "codgeo_res" field.

Could you throw light for me? Could you help me in order to translate this
objective to functional sql queries? 

Up to now, i tried to run this query throw qgis interface called "virtual
layer creation" :
------------------------------------------------------
Code:

select
st_makeline(st_makepoint(entrants_only.x_resi,entrants_only.y_resi),st_makepoint(entrants_only.x_tr,entrants_only.y_tr))as
geometry,sum(entrants_only.ipondi) as sumipondi, entrants_only.codgeo_res as
codgeo_res, entrants.codgeo_tr as codgeo_tr

from entrants_only
group by entrants_only.codgeo_res
--------------------------------------------------------

But i get this error message :
---------------------------------------------------------
query preparation error on PRAGMA table_info(_tview): no such column
entrants_only.geom
---------------------------------------------------------

Moreover, i send you by attachment the Screen shot representing the error
message. 
<a class="moz-txt-link-rfc2396E" href="http://osgeo-org.1560.x6.nabble.com/file/t365144/ss_error_message_qgis2.jpg"><http://osgeo-org.1560.x6.nabble.com/file/t365144/ss_error_message_qgis2.jpg></a> 

In advance, thank you for your help. 





--
Sent from: <a class="moz-txt-link-freetext" href="http://osgeo-org.1560.x6.nabble.com/QGIS-User-f4125267.html">http://osgeo-org.1560.x6.nabble.com/QGIS-User-f4125267.html</a>
_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></pre>
    </blockquote>
    <br>
  </body>
</html>