0

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
2
  • GROUP BY should come after the WHERE clause and shouldn't be a part of it Commented Jun 26, 2019 at 3:48
  • For a question here is better if you rename some columns in order to make the question more understandable. Reviewing your query, it seems to have an extra "and" before the GROUP BY Commented Jun 26, 2019 at 4:17

2 Answers 2

1

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
Sign up to request clarification or add additional context in comments.

1 Comment

It worked. Thank you for explaining it and correcting it.
0

delete operator "and" before GROUP BY

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.