Subject | Re: [firebird-support] newbie question |
---|---|
Author | Lester Caine |
Post date | 2004-08-31T21:03:26Z |
jaybirdbsu wrote:
misc cols,
( SELECT DESCRIPTION FROM Table1
WHERE KEY = Table2.Simple ) AS Simple,
( SELECT DESCRIPTION FROM Table1
WHERE KEY = Table2.Another ) AS Another
FROM Table2
--
Lester Caine
-----------------------------
L.S.Caine Electronic Services
> Hello all,SELECT
> I am new to firebird and SQL so I am sure this is a stupid
> question but here goes anyway. I have the following two tables
>
> Table1
> KEY DESCRIPTION
> ------- -------------------
> ZZZA Simple Description one
> ZZZB Simple Description 2
> ZZAA Another Desc 1
> ZZAB Another Desc 2
>
> Table2
> misc cols... Simple Another
> ------------ -------- ---------
> blah blah ZZZA ZZAB
> ...
>
> Anyway, what I would like to do would be to Select every row from
> table2 but I don't want the 4 character description codes, I want to
> return the corresponding description from table1. I got it working
> for one column by using a left outer join but I can not figure out
> how to make it work (and work somewhat effeciently) with two columns
> to subsitute. I hope this makes sense. Any and all help will be
> greatly appreciated.
misc cols,
( SELECT DESCRIPTION FROM Table1
WHERE KEY = Table2.Simple ) AS Simple,
( SELECT DESCRIPTION FROM Table1
WHERE KEY = Table2.Another ) AS Another
FROM Table2
--
Lester Caine
-----------------------------
L.S.Caine Electronic Services