我有以下查询
SELECT
R.CATENTRY_ID_PARENT AS PARENT,
R.CATENTRY_ID_CHILD AS CHILD,
D.NAME AS NAME,
INTEGERVALUE AS INTEGERVALUE,STRINGVALUE AS STRINGVALUE,
D.SHORTDESCRIPTION AS SDESC, D.LONGDESCRIPTION AS LDESC, D.keyword AS KEYWORD, C.MFPARTNUMBER AS HOLIMAGEPATH, avl.topimage AS THUMB,
(case when (exists (Select INTEGERVALUE from xstoreattrval M1 where M1.store_id =10051 and M1.xstoreattr_id in (select xstoreattr_id from xstoreattr M2 where M2.name in ('hasClubExlusives')))) then INTEGERVALUE else null end) as INTEGERVALUE,
(case when (exists (Select STRINGVALUE from attrvalue M3 where M3.attribute_id in (select attribute_id from attribute M4 where M4.name in ('clubExclusive') and M4.catentry_id=CAT1ID))) then STRINGVALUE else null end) as STRINGVALUE,
C.CATENTRY_ID as CAT1ID
FROM CATENTREL R, CATENTRY C, CATENTDESC D, XCATENTAVL avl,
(Select INTEGERVALUE from xstoreattrval M1 where M1.store_id =10051 and M1.xstoreattr_id in (select xstoreattr_id from xstoreattr M2 where M2.name in ('hasClubExlusives'))) as INTEGERVALUE,
(Select STRINGVALUE from attrvalue M3 where M3.attribute_id in (select attribute_id from attribute M4 where M4.name in ('clubExclusive') and M4.catentry_id=CAT1ID)) as STRINGVALUE
--INNER JOIN ATTRVALUE V ON V.CATENTRY_ID = C.CATENTRY_ID
--INNER JOIN ATTRIBUTE AT ON V.ATTRIBUTE_ID = AT.ATTRIBUTE_ID
WHERE C.CATENTRY_ID = D.CATENTRY_ID
AND C.BUYABLE = 1
AND C.MARKFORDELETE = 0
AND D.PUBLISHED = 1
AND R.CATENTRY_ID_PARENT = C.CATENTRY_ID
--AND NOT (INTEGERVALUE1 = '0' AND STRINGVALUE2='true')
AND C.CATENTRY_ID = AVL.CATENTRY_ID
AND C.CATENTTYPE_ID = 'ProductBean'
AND R.CATENTRY_ID_PARENT IN (
SELECT DISTINCT CC.CATENTRY_ID
FROM CATENTRY CC, CATGPENREL RR, CATGROUP GG, CATGRPDESC DD
WHERE RR.CATALOG_ID = 10901
AND CC.CATENTRY_ID = RR.CATENTRY_ID
AND GG.CATGROUP_ID = RR.CATGROUP_ID
AND GG.CATGROUP_ID = DD.CATGROUP_ID
AND DD.NAME NOT LIKE 'PULLED%'
) ORDER BY R.CATENTRY_ID_PARENT FOR READ ONLY WITH UR
但是在第二种情况下,分配CAT1ID
不起作用。它抛出如下错误
Error: DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=CAT1ID, DRIVER=4.1.85
有人可以帮忙吗?