<div>SELECT * FROM Sets </div><div>WHERE (NumericSetNumber >= num-1 AND NumericSetNumber <= num-2) OR (NumericSetNumber >= num-3 AND NumericSetNumber <= num-4) </div>OR (NumericSetNumber >= num-5 AND NumericSetNumber <= num-6) ... <div>ORDER BY SortKey ASC;</div>
Please use our links: LEGO.com • Amazon
Recent discussions • Categories • Privacy Policy • Brickset.com
Brickset.com is a participant in the Amazon Services LLC Associates Program, the Amazon.com.ca, Inc. Associates Program and the Amazon EU Associates Programme, which are affiliate advertising programs designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.
As an Amazon Associate we earn from qualifying purchases.
Comments
If you limited the DB user that makes the queries to only making SELECTs as well as verify the submitted query and make sure it it returns valid and expected results (that is, only queries on the Sets table), you'd be fine, no?
Either way, if I can't make a direct query, fine, but is there a way to do what I want to do through the query interface then?
Thanks.
Either way, I saw a direct query as the best way to get what I wanted. Ultimately, if I can get what I want through the interface, then I'm happy.
Given what I'm trying to do as outlined in my original post, is there a way to create that kind of query through the interface?
Thank you.
SELECT * FROM Sets
WHERE (NumericSetNumber >= 79100) AND (NumericSetNumber <= 79105 OR NumericSetNumber >= 79115) AND (NumericSetNumber <= 79122 OR NumericSetNumber >= 70800) AND (NumericSetNumber <= 70819)
ORDER BY SortKey ASC
However, the parentheses are in the wrong location (and I can't move them around). What I want is the following:
SELECT * FROM Sets
WHERE (NumericSetNumber >= 79100 AND NumericSetNumber <= 79105) OR (NumericSetNumber >= 79115 AND NumericSetNumber <= 79122) OR (NumericSetNumber >= 70800 AND NumericSetNumber <= 70819)
ORDER BY SortKey ASC
Similarly, you could have a "Clone Condition" button or something that would clone a line and reproduce it.
Long story short, the query builder is a nice idea, but it's very limiting/cumbersome for building out complex or useful queries.
As far as I can see, you want to list the following:
Sets 79100, 79101, 79102, 79103, 79104, 79105.
OR
Sets 79115, 79116, 79117, 79118, 79119, 79120, 79121, 79122.
OR
Sets 70800 through to 70819.
The problem I see with this is that it's simply an odd query. Which one of those three do you want to list? You're not asking it to list all of them, just one batch of the three.
I suspect you're wanting all of them, but in that case wouldn't you be better using the AND statement?
To be clear, I do see your problem with the brackets. I didn't quite see that until I tried to do a similar search myself, but it is a problem in this case.
I do think though, that even if the brackets were in the correct places, you'd still need to use AND instead of OR. :)
https://brickset.com/sets?query=79100-79105
You can also specify a comma delimited list, e.g.
https://brickset.com/sets?query=79115,79116,79117,79118,79119,79120,79121,79122
but not combine the two
I'm simply trying to list out all the sets that I own so that when my daughters want to do one, instead of having to move all the boxes around on the shelves searching for which one they want to do, that can quickly look at a more visual and organized list from a computer screen / iPad and pick one out.
And really, regardless of the use case, a query builder should be designed to be flexible enough to handle what I consider to be a relatively simple query.
Also, I would only use an AND statement if I was listing each set number out separately. For multiple ranges, you have to use ORs between them. For example, "The set is within this range OR this range OR this range."
Huw, thanks for your response. The ability to add all the sets directly to the URL does help as it's a lot, lot quicker way to get what I want than clicking through the query builder to add each set separately. Still, what would be ideal is if you could combine the commas and the hyphens in the URL to include multiple ranges. For example:
https://brickset.com/sets?query=79100-79105,79115-79122,70800-70819
That seems like some pretty basic URL parsing to me (which you're already doing separately), and it would add a lot of power to searching on the site.
Thanks.
In that case there's a much easier way!
https://brickset.com/sets/mycollection-owned
If I click on "I want this set", where is that list stored? (Sorry, still learning all of this.)
https://brickset.com/sets/mycollection-wanted
Here is a list of useful tips on how to use/navigate the site:
https://brickset.com/faq
I wasn't thinking of it in terms of 'add a set to the list if it appears in *this query* OR *this query*'.
Anyway, thanks for the help, guys.
Just out of curiosity, what're the back-end technologies used for this site? Is it a standard LAMP config?
Huw, are you the sole developer and is this a side hobby or a full-time job?
Just wanted to let you know that this is a very cool site. Just came across it recently, but it's great for searching. All of the cross-linking and tagging is very, very helpful.
Thanks.
https://brickset.com/tools/webservices