现有两个表codeTable 表
code codename
1 是
0 否
infoTable 表
字段1 字段2 字段3 code
现在想从infoTable 表中查出信息,并将code相对应的 codename也想显示出来,那该sql语句该如何写?
code codename
1 是
0 否
infoTable 表
字段1 字段2 字段3 code
现在想从infoTable 表中查出信息,并将code相对应的 codename也想显示出来,那该sql语句该如何写?
调试欢乐多
LEFT JOIN codeTable B ON A.CODE=B.CODE
select * from codetable x,infotable y where x.code=y.code;
left join codeTable b on a.code=b.com
from infoTable t, codeTable t1
where t.code = t1.code(+)
再补充一点吧:
code codename codetype
1 是 a
0 否 a
1 好 b
0 坏 binfoTable 表
字段1 字段2 字段3 a b
值1 值2 值3 0 1
值6 值4 值5 1 0
这时想得到infoTable 中的所有信息,并且得到a,b相应类型所得的codename值,应该如何写sql?