The database that I am using is MySQL. I have an
options table that roughly looks like this
id int(10) PRIMARY annex_id int(10) title varchar(255) sort_order INT(10) NOT NULL
Every annex (annex_id) has bunch of options enumerated by
sort_order column which varies from 1 to N and are controlled by humans.
Due to software bug from a couple of months a lot of annexes do not have an option with sort_order == 1 but rather start from 2 or 3.
What I want to do is get all the
annex_id‘s which contain options that do not have sort_order == 1. I’ll show an exemplary table because I feel like I’m explaining it wrong (which could be the reason I can’t come up with a query for it and I’ve been at it for hours).
|ID||Annex ID||Title||Sort Order|
|15||890||Another title #1||2|
|16||890||Another title #2||3|
From the given table I pretty much want craft a query that would get annex id 890 because it doesn’t have a row with sort order == 1.
The table has hundreds of thousands of rows and going at it by hand is insane. I’ve been dealing with databases for years and either I’m overthinking it or idk what but I can’t come up with an efficient query to do this job.
Is it even possible to have a query like this?