select translate(id1,'123','abc')||translate(id2,'123','abc')||translate(id3,'123','abc') from table1 和上面的一样,局限性比较大
樓上把table2的内容給寫死在SQL裏了,如果以後資料變動要改SQL語句很麻煩 建議用下面的SQL語句,不怕Table2种資料變化。select a.name,b.name,c.name from table1 M,table2 a,table2 b,table3 c where M.id1=a.id(+) and M.id2=b.id(+) and M.id3=c.id(+)上面用(+)的目的是爲了防止有Table2种無對應值得問題。 如果樓主保證table2中一定存在,那麽可以將(+)去掉
和上面的一样,局限性比较大
建議用下面的SQL語句,不怕Table2种資料變化。select a.name,b.name,c.name
from table1 M,table2 a,table2 b,table3 c
where M.id1=a.id(+)
and M.id2=b.id(+)
and M.id3=c.id(+)上面用(+)的目的是爲了防止有Table2种無對應值得問題。
如果樓主保證table2中一定存在,那麽可以將(+)去掉