Link to home
Create AccountLog in
Avatar of deleyd
deleydFlag for United States of America

asked on

SQL using XREF table

I'm rusty on my SQL. I need a statement which is essentially:

SELECT * FROM MYTABLE WHERE ID = (given 'name', find row in XREF table matching name, get corresponding id from that row)

Open in new window

and the XREF table is something like:
Name     Id
----     --
David    1
Susan    2
Charlene 3

Open in new window

and MYTABLE is something like:
Id   Stuff
--   -----
1     xxx
1     yyy
1     zzz
2     aaa
2     bbb
3     ccc

Open in new window

I'm given a name, such as 'David', and I want to select the rows in MYTABLE with Id=1.

(This is an Oracle database, if that makes any difference.)
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account