I want to order the records in my tasks table according to completed and then according to workOrderID, just like I can to with the ORDER BY clause of a SELECT query, so that this
| taskID | workOrderID | completed |
|---|---|---|
| 1 | 1 | t |
| 2 | 1 | f |
| 3 | 3 | t |
| 4 | 2 | t |
| 5 | 9 | t |
| 6 | 4 | f |
| 7 | 5 | f |
| 8 | 4 | t |
| 9 | 1 | f |
is stored like this
| taskID | workOrderID | completed |
|---|---|---|
| 1 | 1 | t |
| 4 | 2 | t |
| 3 | 3 | t |
| 8 | 4 | t |
| 5 | 9 | t |
| 2 | 1 | f |
| 9 | 1 | f |
| 6 | 4 | f |
| 7 | 5 | f |
When I try, I get a syntax error, and I don't see that functionality mentioned in the docs. I think this could speed up some queries.
(completed DESC, workOrderID, taskID)– Charlieface Feb 10 '24 at 18:59When I try- when you try what, exactly? There's no reason why you can't create an index on (completed, workOrderID) andCLUSTERon that? I'm VtC but will vote to Reopen if you provide the answers to the questions you've been asked. – Vérace Feb 28 '24 at 10:50