Skip to content

Instantly share code, notes, and snippets.

@Endermanbugzjfc
Last active September 11, 2023 10:04
Show Gist options
  • Save Endermanbugzjfc/0c8e3b4b1024d2cacc6f1e87c6bd319c to your computer and use it in GitHub Desktop.
Save Endermanbugzjfc/0c8e3b4b1024d2cacc6f1e87c6bd319c to your computer and use it in GitHub Desktop.
Hint: some general programming ideas are applied on here. Ask yourself: why is the * 2 + used on booleans instead of numbers.
SELECT * FROM Customers
WHERE uuid = "weqsc" OR wtfid = "weqsc"
ORDER BY (uuid IS NOT NULL) * 2 + (wtfid IS NOT NULL) DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment