Imagine I have a table that has two pairs of coordinates, start_x, start_y 
and end_x, end_y. I'm trying to find all lines that connect two points 1,1 
and 2,2, without knowing which is the start and which is the end.

This is almost there, but not quite.

irb(main):004:0> DB[:lines].where(start_x: 1, start_y: 1).or(start_x: 2, 
start_y: 2).where(end_x: 1, end_y: 1).or(end_x: 2, end_y: 2)
=> #<Sequel::SQLite::Dataset: "SELECT * FROM `lines` WHERE (((((`start_x` = 
1) AND (`start_y` = 1)) OR ((`start_x` = 2) AND (`start_y` = 2))) AND 
(`end_x` = 1) AND (`end_y` = 1)) OR ((`end_x` = 2) AND (`end_y` = 2)))">

The red part is where it goes wrong. I want it to do:

SELECT * FROM `lines` WHERE (((`start_x` = 1) AND (`start_y` = 1)) OR 
((`start_x` 
= 2) AND (`start_y` = 2))) AND (((`end_x` = 1) AND (`end_y` = 1)) OR ((`end_x` 
= 2) AND (`end_y` = 2)))

I've trawled through all the querying documentation I can find, but haven't 
been able to find an answer. Any help would be appreciated. 

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to