Skip to content

Instantly share code, notes, and snippets.

@monolighter
Created November 14, 2019 17:07
Show Gist options
  • Save monolighter/dec1bd68ed104cc3da43ecf56df5548e to your computer and use it in GitHub Desktop.
Save monolighter/dec1bd68ed104cc3da43ecf56df5548e to your computer and use it in GitHub Desktop.
Yo, optimize dat shit bruh, let's find a nice solution. Any comments are welcome, e.g. database storage type.
(
select *
from `entity`
where
`id` = 1
and `subid` not in (3, 2, 1)
) union all (
select *
from `entity`
where
`subid` in (3, 2, 1)
and `id` not in(1)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment