求一select语句的写法!(加急!)

dragonsou 2003-05-28 08:44:25
有这样的两个表:
表 A
ID(单号) class1(分类1) class2(分类2)
-----------------------------------------------------
1 1 2
2 3 1


表 B
class_NO(分类代码) class_name(分类名称)
------------------------------------------------------
1 进货
2 出货
3 提货

我现在想select后输出的表如下:
ID class1_name class2_name
-----------------------------------------------------
1 进货 出货
2 提货 进货


请问这语句怎么写法?请指教!谢谢!
...全文
28 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
yb3721 2003-05-28
  • 打赏
  • 举报
回复
things(平) 的语句2非常明了
dajian2000 2003-05-28
  • 打赏
  • 举报
回复
一楼的也对,就是复杂点,呵呵:)
dajian2000 2003-05-28
  • 打赏
  • 举报
回复
select a.id,x.class_name class1_name,y.class_name class2_name from a,b x,b y
where a.class1=x.class_no and
a.class2=y.class_no;
things 2003-05-28
  • 打赏
  • 举报
回复
1.select id, class_name, class_name
from a, b, c
where a.class1=b.class_no
and a.class2=b.class_no

上面语句1可能有问题,可以使用2
2.
select t1.id, t1.class_name, t2.class_name
from
(select id, class_name
from a, b
where a.class1 = b.class_NO) t1,
(select id, class_name
from a, c
where a.class2 = b.class_NO) t2
where t1.id = t2.id

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧