简体   繁体   中英

Oracle SQL I cannot do group by

The error I'm getting is Missing Expression

Below is my SQL statement

select 
ecell_name, 
ecell_relation,
pmm_datetime,

pmHoExeOutAttLteInterFQci1 As_Exec_Attempt_Out
--pmHoExeOutSuccLteInterFQci1 As_Exec_Succes_Out, 
--(pmHoTooEarlyHoQci1) As Early_HO, (pmHoTooLateHoQci1)  As Late_HO, 
--(pmHoWrongCellReestQci1) As WrongCellReest_HO, 
--(pmHoWrongCellQci1) As WrongCell_HO, (pmHoOscQci1) As Osc_HO

from PMMCOUNTER_DB.LC_N_EUTRANCELLREL_D

where substr (ECELL_NAME,1,4) in 'BKPA' and pmm_datetime BETWEEN TO_DATE('14/06/2019','DD/MM/YYYY') AND TO_DATE('15/06/2019','DD/MM/YYYY') and direction='Outgoing' 
and GROUP BY ecell_relation

First, you need to delete and orepator before your group by . Second, you need to use all selected fields in your group by . This should works:

 select ecell_name,
       ecell_relation,
       pmm_datetime,

       pmHoExeOutAttLteInterFQci1 As_Exec_Attempt_Out
--pmHoExeOutSuccLteInterFQci1 As_Exec_Succes_Out, 
--(pmHoTooEarlyHoQci1) As Early_HO, (pmHoTooLateHoQci1)  As Late_HO, 
--(pmHoWrongCellReestQci1) As WrongCellReest_HO, 
--(pmHoWrongCellQci1) As WrongCell_HO, (pmHoOscQci1) As Osc_HO

  from PMMCOUNTER_DB.LC_N_EUTRANCELLREL_D

 where substr(ECELL_NAME, 1, 4) in 'BKPA'
   and pmm_datetime BETWEEN TO_DATE('14/06/2019', 'DD/MM/YYYY') AND
       TO_DATE('15/06/2019', 'DD/MM/YYYY')
   and direction = 'Outgoing' 
 GROUP BY ecell_relation, ecell_name, pmm_datetime, pmHoExeOutAttLteInterFQci1

在GROUP BY之前删除运算符“和”

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM