Cheers,
my table layout is:
Quote:
input, output, connection
an example of content would be:
Quote:
john, email, associative
document, send, associative
email, send, associative
send, email, forward
send, document, forward
document, website, forward
email, john, forward
Specifically what i'm trying to achieve is to pull out every "output" where input = 'send' and connection = 'forward', but only if that output is displayed in either "input" or "output" within a query that pulls input and output when the connection is "associative". This is all from a single table
So the single result for the above verbal query would be:
Quote:
send, email, forward
send, document, forward
If you remove the "email, send, associative" entry, it should return only:
Quote:
send, document, forward
(because "email" has a "forward" connection to "send", but not an "associative" one)
Does this make sense?
So I guess the SQL query I WANT to write might look a little like this:
(excuse my poor SQL)
Code:
SELECT * from table WHERE input = 'send' AND connection = 'forward'
AND input IN (SELECT output from table where input = 'send' AND connection = 'associative')
OR output IN (SELECT input from table where output = 'send' AND connection = 'associative')
I'm running in circles with this without being able to nest these queries, but I've heard that joins can do the same job with a bit of trickery, so any help you could give would be really appreciated
