新的开始
凤凰博报 由你开始
http://justforfun.blog.ifeng.com
发表 管理 分类 简介 头像 功能 音乐 友情链接 模板 个性域名

2007-06-19 09:25:49 编辑 删除

浏览 529 次 | 评论 0 条

I have 2 tables.  Say table1 has 100 rows.

Table1 has a field 'MFG' which is a 2 char code.

I want to replace the 2 char code with a lookup value from table2 which may or may not include all 2 char codes...

So I do:

SELECT TABLE2.MFG_CODE FROM table1 LEFT OUTER JOIN table2 ON table1.MFG=table2.MFG;

Because table2 does not contain all possible MFG codes in table1, the query is returning more than the number of rows originally in table1.

Question:  Is there a simpler way to do a lookup of the value I need from table2 while returning all (but not more) rows from table1?

0
上一篇 << 迭代算法求解八皇后问题      下一篇 >> 我的
您还没有登录,请登录以后再发表评论。

博文相关