intersect

SQL: Syntax error with intersect?

This is my query: -- Sids of suppliers who supply a green part AND a red part (SELECT Suppliers.sid FROM Suppliers JOIN Catalog ON Catalog.sid = Suppliers.sid JOIN Parts ON Parts.pid = Catalog.pid WHERE Parts.color = "red") INTERSECT (SELECT Suppliers.sid FROM Suppliers JOIN Catalog ON Catalog.sid = Suppliers.sid JOIN Parts ON Parts.pid...

SQL Search based on multiple values without Intersect

I am trying to search for items (members) that match 0 or more field values in a simple table. I have a solution using INTERSECT, but would like to know if there as a better/simpler solution. Simplfied Scenario: A user will select 0 to 3 fields as search criteria. For each chosen field, the user will select (combobox) a value. These...

interval overlapping in tsql

hi folks, i need to get splited intervals and the number of overlapping intervals, eg basedata: interval A: startTime 08:00, endTime 12:00 interval B: startTime 09:00, endTime 12:00 interval C: startTime 12:00, endTime 16:00 interval D: startTime 13:00, endTime 14:00 now i have a separate interval from 10:00 to 15:00 and have to de...

mySQL experts - need help with 'intersect'

I know that mySQL 5.x does not support INTERSECT, but that seems to be what I need. Table A: Products (p_id) Table B: Prod_cats (cat_id) - category info (name, description, etc) Table C: prod_2cats (p_id, cat_id) - many to many prod_2cats holds the many (1 or more) categories that have been assigned to Products (A). Doing a query/fi...

Subtracting Delphi Time Ranges from a Date Range, Calculate Remaining Time

I'm looking for an algorithm that will help calculate a workday working time length. It would have an input date range and then allow subtracting partially or completely intersecting time range slices from that date range and the result would be the number of minutes (or the fraction/multiple of a day) left in the original date range, a...

How can I check if a Ruby array includes one of several values?

I have two Ruby arrays, and I need to see if they have any values in common. I could just loop through each of the values in one array and do include?() on the other, but I'm sure there's a better way. What is it? (The arrays both hold strings.) Thanks. ...

Intersect in mysql

Hello everyone I need to implement following query in mysql (select * from emovis_reporting where (id=3 and cut_name= '全プロセス' and cut_name='恐慌') ) intersect ( select * from emovis_reporting where (id=3) and ( cut_name='全プロセス' or cut_name='恐慌') ) I know that intersect is not in m Mysql. So I need alternate way. Please guide me.... ...

How can I use LINQ to find the Intersect between two properties of the same collection?

Given an IList<Foo> with a data set that looks like this: ID CHILD PARENT TYPE 1 102 101 UPSELL 1 103 101 UPSELL 2 102 101 BONUS 2 104 103 BONUS 3 102 101 BONUS 4 102 101 PRODUCT 4 104 102 PRODUCT How can I use LINQ to find a child which has a parent with the s...

Linq to Nhibernate - Compare 2 lists

I have 2 lists and I need to know if there are any matches. I've tried using request.Interests.Intersect(x.Post.Tags.Split(' ')).Count() > 0 but I get the error System.NotImplementedException : The method Intersect is not implemented. So, I tried a recursive function that returns a bool. And it's as if the function call is jus...

Calculating intersect point of 2 lat/lng line segments on earth

Hello, i've been trying multiple functions including 2D ones to try to get this somewhat working, but no luck yet... I have 2 line segments of latlng endpoints on earth, and i want to know if and where the 2 lines intersect. I'm currently working with this which a physics major says should be doing the job for a 2d plane but its not. i...

Union, intersect, difference large IntSet in O(m+n) times

from my question http://stackoverflow.com/questions/3601472/insert-element-to-arraylist-with-ascending-order-and-no-duplicate-elements i've done my insert method. Now i try to find out union, intersect, and difference method to operate 2 IntSet. Notice that number elements of IntSet is large and i need to do it in O(m+n) time where ...

Intersecting Points and Polygons in R

Hi, I am working with shapefiles in R, one is point.shp the other is a polygon.shp. Now, I would like to intersect the points with the polygon, meaning that all the values from the polygon should be attached to the table of the point.shp. I tried overlay() and spRbind in package sp, but nothing did what I expected them to do. Could a...

Nested SQL Query

I have the following tables: Club: Club_ID | Title | Created_Date | ... Club_Intesect: User_ID | Club_ID | Access I'm trying to select a variable number of clubs, and join the ID of the user with the highest access in that club. This person is considered the owner. So if Club 100 has Members A, B, C with access 3,4, and 5 ...

Linq to SQL and Intersect

Folks, I need to use Intersect on a LINQ to SQL query. However, I get an exception basically stating that I can't. The code compiles fine, but LINQ to SQL gets angry. Is there any way to replicate Intersect with LINQ to SQL? Thanks in advance. ...

Intersect polygon with rectangle and create lines (section cut)

I need an algorithm to intersect a (potentially non-convex) polygon with a rectangle. The rectangle will be parallel to the xy-plane, but the polygon could be any orientation. Furthermore, I don't just need a true/false result, but also the exact points where the polygon intersects the rectangle, so that I can draw lines where the poly...

Using LINQ to objects Intersect and Except on a specific property

When I have 2 List<string> objects, then I can use Intersect and Except on them directly to get an output IEnumerable<string>. That's simple enough, but what if I want the intersection/disjuction on something more complex? Example, trying to get a collection of ClassA objects which is the result of the intersect on ClassA object's AStr1...

jquery arrays intersect

Hi, I previously posted this question as jquery/javascript: arrays - http://stackoverflow.com/questions/3969576/jquery-javascript-arrays. But since I am a complete beginner I have formulated the question wrong and didn't understand the answers either.... :( After failing to implement the given solutions I did some more looking around I...