Compare Number to Number
The order filter searches for user_id = 2, but the value was passed as text, preventing the fast path on numeric user_id. Rewrite the condition so user_id is compared to the number 2, keeping sorting by id.
Original query
SELECT * FROM orders WHERE user_id = '2' ORDER BY id
Sampla aschuir a bhfuiltear ag súil leis
Seo é an chuma a bheadh ar fhreagra ceart — tá a líon rónna féin aige, ní gá dó na táblaí scéime a mheaitseáil.
| id | status | user_id | created_at |
|---|---|---|---|
| 12 | paid | 2 | 2024-02-04T09:00:00 |
| 15 | pending | 2 | 2024-02-07T11:00:00 |
Logáil isteach chun stair na n-aighneachtaí a fheiceáil
Logáil isteachLogáil isteach chun an Meantóir IS a úsáid
Logáil isteach