Andrew,
First off delete the single quotes, my mistake. I didn't actually use
'table_name'.a or 'table_name'.b it was 'table_name' a and 'table_name' b
(note spaces not periods). This just creates aliases for table_name when we
join it to itself. So if the table name is readings the statement would
become:
SELECT a.*
FROM readings a
LEFT JOIN readings b
ON a.id=b.id AND a.datetime<b.datetime
WHERE b.datetime IS NULL
ORDER BY id;
Added the ORDER BY if you want it sorted on id.
Gary
On Tuesday, 8 November 2016 23:41:26 UTC+10, Andrew Milner wrote:
>
> Gary
> If the data is in a table called readings then I assume
> 'table_name'.a refers to readings - but what does 'table_name'.b referring
> to??
>
>
>
> On Tuesday, 8 November 2016 10:51:16 UTC+2, gjr80 wrote:
>
>> Andrew,
>>
>> My SQL is somewhat rusty but what about something like:
>>
>> SELECT a.*
>> FROM 'table_name' a
>> LEFT JOIN 'table_name' b
>> ON a.id=b.id AND a.datetime<b.datetime
>> WHERE b.datetime IS NULL
>>
>> where the table is table_name. Not tested.
>>
>> Gary
>>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.