Users With Paid Orders
Marketing is building a list of users who have at least one order with status = 'paid'. Rewrite the report without the nested list check and return unique user id values sorted by id.
Original query
SELECT u.id FROM users u WHERE u.id IN (SELECT user_id FROM orders WHERE status = 'paid') ORDER BY u.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 |
|---|
| 1 |
| 2 |
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