I need some help with the select statement.
I have two tables defined in my DB, say A and TYPE. Table TYPE contains key
value pairs.
Table A contains a field with the key references of table TYPE.
Can I code a select which will grab the value of the key in the TYPE table
rather than the key?
CREATE table A
name CHAR
type INT (contains the seq number of the entry in table TYPE)
addr CHAR
CREATE table TYPE
seq INT
desc CHAR
SELECT * from A\g
+-------+-------+-------------------------------------------+
| name | type | addr |
+-------+-------+-------------------------------------------+
| xyz | 1 | 1455 Market St. SF, CA |
| abc | 3 | 1000 Temple Ave Los Angeles CA |
| 123 | 2 | 201 3rd Street SF, CA |
SELECT * from TYPE\g
+-------+-------+
| seq | desc |
+-------+-------+
| TYPA | 1 |
| TYPB | 2 |
| TYPC | 3 |
This is what I would like a single select to return rather doing two selects:
select A.*,TYPE.desc from A,TYPE where (the magic)
| xyz | TYPA | 1455 Market St. SF, CA |
| abc | TYPC | 1000 Temple Ave Los Angeles CA |
| 123 | TYPB | 201 3rd Street SF, CA |
Any help would be greatly appreciated.
Thank you.
-------------------------------------------------------------------------
To unsubscribe, go to http://www.Hughes.com.au/extras/email/
This archive was generated by hypermail 2b30 : Mon Mar 04 2002 - 09:03:51 EST