Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> SQL query puzzler
I've been thinking about how to do this for some time:
Say I have two tables, USER and COMPUTER.
USER looks like this:
user_nm
user_id
COMPUTER looks like this:
computer_nm
upper_user_id
lower_user_id
I want to get ALL users and computers (return for this query will be fed to a crosstab window) and indicate somehow (with Y or N or 1 or 0) whether user_id is between upper_user_id and lower_user_id or not.
How can I do this? An outer join doesn't seem to do the trick for me. And I'm not sure of the syntax for a 'between' kind of join and being outer, if you know what I mean:
...WHERE user_id between lower_user_id and upper_user_id (+)
I've done some strange queries, but this (seemingly) simple query is eluding me. I need some expertise here.
Cheerio,