I have 100 records.I want to keep first 10 records and delete the rest 90.How to query this delete scenario?
Below is the query to select first 10:
select * from content where _type=“PageHistory” and pageId=“91001fac-d646-4c42-9011-c558c89c855e” order by createdAt desc limit 10
1 Like
vsr1
March 6, 2019, 1:41pm
2
DELETE FROM content
where _type=“PageHistory” and pageId=“91001fac-d646-4c42-9011-c558c89c855e”
ORDER BY createdAt DESC OFFSET 10;
1 Like
vsr1:
ORDER BY
getting the following error which using the DELETE statement
{
“code”: 3000,
“msg”: “syntax error - at ORDER”,
“query_from_user”: “delete FROM content\r\nwhere _type=“PageHistory” and pageId=“91001fac-d646-4c42-9011-c558c89c855e” \r\nORDER BY createdAt desc offset 10 ;”
}
vsr1
March 7, 2019, 1:05pm
4
DELETE FROM content USE KEYS (SELECT RAW META().id FROM content
where _type=“PageHistory” and pageId=“91001fac-d646-4c42-9011-c558c89c855e”
ORDER BY createdAt DESC OFFSET 10);