【发布时间】:2017-03-05 17:21:20
【问题描述】:
我有以下疑问...
SELECT msn.id_notificacion AS notifiId, plt.planta_id AS plantaId, plt.planta_desc AS plantaDesc, orgPlt.org_id AS orgIdPlanta,
orgPlt.org_desc AS orgDescPlanta, age.agencia_id AS agenciaId, age.agencia_desc AS agenciaDesc, orgAge.org_id AS orgIdAgencia,
orgAge.org_desc AS orgDescAgencia, msn.user_contac AS usuario, msn.email_orig AS correo
FROM cat_cpd_orig_ip msn
FULL OUTER JOIN cat_plantas_erp plt ON msn.planta_id = plt.planta_id
FULL OUTER JOIN cat_planta_loc pltLoc ON plt.planta_id = pltLoc.planta_id
FULL OUTER JOIN cat_organizacion_adi orgPlt ON pltLoc.org_id = orgPlt.org_id
FULL OUTER JOIN cat_agencia_erp age ON msn.agencia_id = age.agencia_id
FULL OUTER JOIN cat_agencia_loc ageLoc ON age.agencia_id = ageLoc.agencia_id
FULL OUTER JOIN cat_organizacion_adi orgAge ON ageLoc.org_id = orgAge.org_id
WHERE msn.id_notificacion IS NOT NULL GROUP BY usuario ORDER BY usuario
但是当我对结果进行分组时,出现以下错误...
ORA-00904: "USUARIO": identificador no valido
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Error en la línea: 11, columna: 48
我的查询返回以下结果...
27 4570 BLM_ATITALAQUIA 63 BARCEL PRUEBA PLANTA TRES prueba.planta_3@grupobimbo.com
9 109 WM_MEXICO 62 BIMBO PRUEBA PLANTA DOS prueba.planta_2@grupobimbo.com
8 727 STE_MARINELA VILLAHERMOSA 62 BIMBO PRUEBA PLANTA DOS prueba.planta_2@grupobimbo.com
29 1225 BLM_LAGUNA 63 BARCEL PRUEBA PLANTA TRES prueba.planta_3@grupobimbo.com
28 1605 BLM_CDIS OCCIDENTE 63 BARCEL PRUEBA PLANTA TRES prueba.planta_3@grupobimbo.com
3 5483 GLO_MEXICO 64 EL GLOBO PRUEBA PLANTA UNO prueba.planta_1@grupobimbo.com
但我需要以下结果...
3 5483 GLO_MEXICO 64 EL GLOBO PRUEBA PLANTA UNO prueba.planta_1@grupobimbo.com
9 109 WM_MEXICO 62 BIMBO PRUEBA PLANTA DOS prueba.planta_2@grupobimbo.com
27 4570 BLM_ATITALAQUIA 63 BARCEL PRUEBA PLANTA TRES prueba.planta_3@grupobimbo.com
我需要按“usuario”对结果进行分组,你能帮帮我吗?
谢谢!
【问题讨论】:
标签: sql oracle group-by outer-join