If I have data that looks like this:
how would i write a query in N1QL to only return the latest document (using the playbook_log_date field) for distinct locations? this worked:
`SELECT DISTINCT(name), status FROM `testdb` where type="location_status" order by playbook_log_date;`
But it doesn’t return all the fields in the document.
So I tried this:
SELECT DISTINCT(name), status, playbook_log_date FROMtestdb
where type="location_status" order by playbook_log_date;
But that returns more than one record per location. I just want one record per location - the latest one - with all the data in the doc showing.