Two Paths to Orders
The report needs orders for user_id = 1 plus all orders with status = 'paid'. Rewrite the slow mixed filter as two independent result sets, then return one de-duplicated result sorted by id.
Original query
SELECT * FROM orders WHERE user_id = 1 OR status = 'paid' ORDER BY id
Kampjun tal-output mistenni
Dan hu kif tidher tweġiba korretta — l-għadd tar-ringieli huwa tiegħu stess, m'għandux għalfejn jaqbel mat-tabelli tal-iskema.
| id | status | user_id | created_at |
|---|---|---|---|
| 10 | paid | 1 | 2024-02-01T10:00:00 |
| 11 | paid | 1 | 2024-02-03T12:00:00 |
| 12 | paid | 2 | 2024-02-04T09:00:00 |
Idħol biex tara l-istorja tas-sottomissjonijiet
IdħolIdħol biex tuża l-Mentor tal-AI
Idħol