大家好,我有以下表格-
tr_resource 作为 res -
Resourceid name
135021 ABC
tr_charac 作为 chlev -
characid name
1 CH1
2 CH2
tr_characvalue 作为 cvlev -
characvalueid characid stringvalue
cv1 1 XX
cv2 2 YY
cv3 2 zz
tr_resourcecharac 作为 rchlev -
resourceid characvalueid
135021 cv2
当我在查询下运行时-
select
res.name,
cvlev.stringvalue
from tr_resource res
left outer join tr_resourcecharac rchlev on res.RESOURCEID = rchlev.RESOURCEID
inner join tr_characvalue cvlev on rchlev.CHARACVALUEID = cvlev.CHARACVALUEID
inner join tr_charac chlev on chlev.CHARACID = cvlev.CHARACID and chlev.NAME = 'CH2'
where res.resourceid=135021
我得到的答案是 -
name stringvalue
ABC YY
但是当我在查询下运行时,我没有得到任何答案 -
select
res.name,
cvlev.stringvalue
from tr_resource res
left outer join tr_resourcecharac rchlev on res.RESOURCEID = rchlev.RESOURCEID
inner join tr_characvalue cvlev on rchlev.CHARACVALUEID = cvlev.CHARACVALUEID
inner join tr_charac chlev on chlev.CHARACID = cvlev.CHARACID and chlev.NAME = 'CH1'
where res.resourceid=135021
我想得到答案 -
name stringvalue
ABC null
能否请你帮忙?