我有以下选择查询:
select distinct(e.ENGINE_ID),
e.ENGINE_NAME,
os.OBJECT_STATUS,
br.NAME,
env.NAME
from ENGINE e,
RATOR_MONITORING.OBJECT_STATUS os,
BRAND_ENGINE be,
ENVIRONMENT env,
BRAND br
where e.ENGINE_ID = os.OBJECT_ID
AND os.OBJECT_TYPE='ENGINE'
AND be.ENGINE_ID = e.ENGINE_ID
AND be.BRAND_ID = br.BRAND_ID
AND br.ENV_ID = env.ENV_ID
order by decode(os.OBJECT_STATUS, 'R',1, 'Y', 2, 'G', 3, 'N',4) asc,
UPPER(e.ENGINE_NAME) asc
上面的查询返回结果为:
如您所见,它返回相同的重复项Engine_ID
,ENGINE_NAME,OBJECT_STATUS,NAME_1
并且该NAME
列具有相同的不同结果ENGINE_ID
。所以我想在单行中返回这些记录的结果。例如如下所述:
ENGINE_ID ENGINE_NAME OBJECT_STATUS NAME NAME_1
39 ORDER_ENGINE G NC,LIDL FONIC