[Qgis-user] Selecting records
Phil (The Geek) Wyatt
phil at wyatt-family.com
Wed Mar 30 15:27:26 PDT 2016
Brilliant - now works - Many thanks Pierma!
From: Pierre-Marie Le Dantec [mailto:pierremarie.ledantec at gmail.com]
Sent: Thursday, 31 March 2016 7:17 AM
To: Phil (The Geek) Wyatt
Cc: Qgis-user at lists.osgeo.org
Subject: RE: [Qgis-user] Selecting records
Do tou have an error or result is not as expected ?
If qgis complains about sql query or invalid layer, it can be because i forgot fields calculated through a function need to be explicitly named:
SELECT stationid, MAX(obs_date) AS max_date FROM your_layer GROUP BY stationid
This should works on any valid layer. Tested successfully with a GeoJSON layer.
Pierma
Le 30 mars 2016 21:19, "Phil (The Geek) Wyatt" <phil at wyatt-family.com> a écrit :
Alas, this doesn't seem to work on the GEOJSON linked layer
From: Pierre-Marie Le Dantec [mailto:pierremarie.ledantec at gmail.com]
Sent: Wednesday, 30 March 2016 3:59 PM
To: Phil (The Geek) Wyatt
Cc: Qgis-user at lists.osgeo.org
Subject: Re: [Qgis-user] Selecting records
Hi Phil,
For manipulating dates throught SQL you should use ISO format ("YYYY-MM-DD").
Then, you can use a virtual layer with :
SELECT stationid, MAX(obs_date) FROM your_layer GROUP BY stationid
Cheers,
Pierma
2016-03-30 13:09 GMT+11:00 Phil (The Geek) Wyatt <phil at wyatt-family.com>:
I must be thick, but I can't get my head around this in QGIS
Data
stationid_
obs_date
BK21
28/03/2016
BK21
29/03/2016
BK21
30/03/2016
BL22
28/03/2016
BL22
29/03/2016
BL22
30/03/2016
BL22
31/03/2016
How do I select the Maximum date for each station ID?
The data will be coming from a GEOJSON feed but I can also pull it as a shape file if needs be
Cheers - Phil
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
--
Pierre-Marie Le Dantec
73.64.34
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20160331/876777e9/attachment.html>
More information about the Qgis-user
mailing list