<p dir="ltr">Do tou have an error or result is not as expected ?<br>
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:</p>
<p dir="ltr">SELECT stationid, MAX(obs_date) AS max_date FROM your_layer GROUP BY stationid</p>
<p dir="ltr">This should works on any valid layer. Tested successfully with a GeoJSON layer.</p>
<p dir="ltr">Pierma</p>
<div class="gmail_quote">Le 30 mars 2016 21:19, "Phil (The Geek) Wyatt" <<a href="mailto:phil@wyatt-family.com">phil@wyatt-family.com</a>> a écrit :<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-AU" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Alas, this doesn't seem to work on the GEOJSON linked layer<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Pierre-Marie Le Dantec [mailto:<a href="mailto:pierremarie.ledantec@gmail.com" target="_blank">pierremarie.ledantec@gmail.com</a>] <br><b>Sent:</b> Wednesday, 30 March 2016 3:59 PM<br><b>To:</b> Phil (The Geek) Wyatt<br><b>Cc:</b> <a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br><b>Subject:</b> Re: [Qgis-user] Selecting records<u></u><u></u></span></p><p class="MsoNormal"><u></u> <u></u></p><div><div><div><div><div><div><p class="MsoNormal" style="margin-bottom:12.0pt">Hi Phil,<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt">For manipulating dates throught SQL you should use ISO format ("YYYY-MM-DD").<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt">Then, you can use a virtual layer with :<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt">SELECT stationid, MAX(obs_date) FROM your_layer GROUP BY stationid<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt">Cheers,<u></u><u></u></p></div><p class="MsoNormal">Pierma<u></u><u></u></p><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">2016-03-30 13:09 GMT+11:00 Phil (The Geek) Wyatt <<a href="mailto:phil@wyatt-family.com" target="_blank">phil@wyatt-family.com</a>>:<u></u><u></u></p><div><div><p class="MsoNormal">I must be thick, but I can't get my head around this in QGIS<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Data<u></u><u></u></p><table border="0" cellspacing="0" cellpadding="0" width="139" style="width:104.0pt;border-collapse:collapse"><tr style="height:15.0pt"><td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt"><p class="MsoNormal"><span style="color:black">stationid_</span><u></u><u></u></p></td><td width="75" nowrap valign="bottom" style="width:56.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt"><p class="MsoNormal"><span style="color:black">obs_date</span><u></u><u></u></p></td></tr><tr style="height:15.0pt"><td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt"><p class="MsoNormal"><span style="color:black">BK21</span><u></u><u></u></p></td><td width="75" nowrap valign="bottom" style="width:56.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt"><p class="MsoNormal" align="right" style="text-align:right"><span style="color:black">28/03/2016</span><u></u><u></u></p></td></tr><tr style="height:15.0pt"><td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt"><p class="MsoNormal"><span style="color:black">BK21</span><u></u><u></u></p></td><td width="75" nowrap valign="bottom" style="width:56.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt"><p class="MsoNormal" align="right" style="text-align:right"><span style="color:black">29/03/2016</span><u></u><u></u></p></td></tr><tr style="height:15.0pt"><td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt"><p class="MsoNormal"><span style="color:black">BK21</span><u></u><u></u></p></td><td width="75" nowrap valign="bottom" style="width:56.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt"><p class="MsoNormal" align="right" style="text-align:right"><span style="color:black">30/03/2016</span><u></u><u></u></p></td></tr><tr style="height:15.0pt"><td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt"><p class="MsoNormal"><span style="color:black">BL22</span><u></u><u></u></p></td><td width="75" nowrap valign="bottom" style="width:56.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt"><p class="MsoNormal" align="right" style="text-align:right"><span style="color:black">28/03/2016</span><u></u><u></u></p></td></tr><tr style="height:15.0pt"><td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt"><p class="MsoNormal"><span style="color:black">BL22</span><u></u><u></u></p></td><td width="75" nowrap valign="bottom" style="width:56.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt"><p class="MsoNormal" align="right" style="text-align:right"><span style="color:black">29/03/2016</span><u></u><u></u></p></td></tr><tr style="height:15.0pt"><td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt"><p class="MsoNormal"><span style="color:black">BL22</span><u></u><u></u></p></td><td width="75" nowrap valign="bottom" style="width:56.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt"><p class="MsoNormal" align="right" style="text-align:right"><span style="color:black">30/03/2016</span><u></u><u></u></p></td></tr><tr style="height:15.0pt"><td width="64" nowrap valign="bottom" style="width:48.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt"><p class="MsoNormal"><span style="color:black">BL22</span><u></u><u></u></p></td><td width="75" nowrap valign="bottom" style="width:56.0pt;padding:0cm 5.4pt 0cm 5.4pt;height:15.0pt"><p class="MsoNormal" align="right" style="text-align:right"><span style="color:black">31/03/2016</span><u></u><u></u></p></td></tr></table><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">How do I select the Maximum date for each station ID?<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">The data will be coming from a GEOJSON feed but I can also pull it as a shape file if needs be<u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Cheers - Phil<u></u><u></u></p></div></div><p class="MsoNormal"><br>_______________________________________________<br>Qgis-user mailing list<br><a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><u></u><u></u></p></div><p class="MsoNormal"><br><br clear="all"><br>-- <u></u><u></u></p><div><div><div><p class="MsoNormal">Pierre-Marie Le Dantec<br><br>73.64.34<u></u><u></u></p></div></div></div></div></div></div></div></blockquote></div>