帮忙写一条SQL语句。
表:systemcode有如下记录
code desname
1 普通用户
2 会员客户
3 普通
4 紧急
5 非常紧急
6 投诉产品
...
主键:code表:law
ID Product Level WTime
1 6 4 2003-12-20 12:12:00
2 6 5 2003-12-20 12:35:07
...
主键:ID现要得到如下结果集,SQL语句该怎么写啊?谢谢。
1 投诉产品 紧急 2003-12-20 12:12:00感觉这是一条很简单的问题,可是怎么也得不到这个结果集大哥们帮帮忙啊!!!
表:systemcode有如下记录
code desname
1 普通用户
2 会员客户
3 普通
4 紧急
5 非常紧急
6 投诉产品
...
主键:code表:law
ID Product Level WTime
1 6 4 2003-12-20 12:12:00
2 6 5 2003-12-20 12:35:07
...
主键:ID现要得到如下结果集,SQL语句该怎么写啊?谢谢。
1 投诉产品 紧急 2003-12-20 12:12:00感觉这是一条很简单的问题,可是怎么也得不到这个结果集大哥们帮帮忙啊!!!
这样不行吗?
from law A,systemcode B,systemcode C
where A.product=B.code and A.level=C.code
Select law.id,A.desname as Product,B.desname as Level,WTime From law,systemcode A,systemcode B Where Product=A.code and Level=b.code
(select desname from systemcode where product=a.code) as product,
(select desname from systemcode where Level=a.code) as Level,
WTime
from code a
(select desname from systemcode where code=a.product) as product,
(select desname from systemcode where code=a.Level) as Level,
WTime
from code a
yoki(小马哥)的方法是对的!马上结帐!!!!