Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
June 2, 2006, 9:02 am
rate this thread
I hope I have explained this well enough for you to understand what I am trying to do.
I table A
depending on CodeType it needs info From Different Tables, How can I do this in SELECT
Select A.Code,A.CodeType,B.NameDesc,C.NameDesc,D.NAmeDesc FROM A
if CodeType=1 then return B.NameDesc FROM B
else if CodeType=2 then return C.NameDesc FROM C
else if CodeType=3 then return D.NameDesc FROM D
how can do the above ?
Re: multiple table selection is this possible - newbie question ?
what I am trying to do.
this in SELECT
This will get you started:
case when codetype = 1 then
(select namedesc from b where b.code = a.code)
when codetype = 2 then
(select namedesc from c where c.code = a.code)
Of course I'm assuming you have "code" in all of your tables. Are tables
b,c,etc. subtypes of A?
- » Americanas.com SALDO de TVs Com at 80% de Desconto (29798)
- — Newest thread in » MySQL Database Forum