162
Views
9
Comments
Advanced SQL Query giving error while the executed SQL is working
Question
Application Type
Reactive
Service Studio Version
11.14.16 (Build 60354)
Platform Version
11.14.1 (Build 34445)

Hello team,

        I am trying to run this sql code getting this "not a group by expression " error which is shown in screenshot1.But the executed sql of this code is working fine in oracle database which is shown in the screenshot2.Can anyone please help me in resolving this issue.

    Screenshot2


Screenshot1

2026-02-26 06-29-24
Rahul
 
MVP

Hi,

it's clear showing some of attribute you are selecting is not in group by please check it.
And the image not showing whole sql statement.

UserImage.jpg
Suvetha Balakrishnan

Hello Rahul,

          kindly find the below screenshot and the group by is the alias name of the attributes. 

2021-09-06 15-09-53
Dorine Boudry
 
MVP

In none of your screenprints are you showing the complete sql from beginning to end

UserImage.jpg
Suvetha Balakrishnan

Hello Dorine,

        I am attaching the complete screenshot of the query here.


2021-09-06 15-09-53
Dorine Boudry
 
MVP

Ok,

so I find it hard to believe if you execute the exact full sql generated from this, you would get the result you want from oracle.

first thing I notice (might not be it, but if not, please explain why this works) :

it looks like you are missing 2 closing round brackets at the end of line 22

EDIT : aah no, that's not it, i can now see the 2 brackets earlier on that line.

Sorry if i led you down the wrong path with this comment

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Suvetha,

Since an ORA error code is given, you can be certain that the error is coming from the (Oracle) database, and that it's not an OutSystems problem. If you Google on that error, you'll find countless troubleshooting tips and tricks.

Personally I'd break down this monstrosity of a query, and see if each individual part runs as expected, before trying it all together.

UserImage.jpg
Suvetha Balakrishnan

Hello Killian,

          Thanks for the reply.The query is working fine in oracle database but while we are converting our code as per Outsystems we are getting not a group by error. Please have a look at screenshot2 which is mentioned in the trial comment and please let me know if there are any possibilities to resolve this.


Thanks

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Suvetha,

If you have access to the Oracle database, you may be able (or ask a DBA) to see the exact query OutSystems is sending to the database, so you can troubleshoot. There is no doubt something amiss with the SQL that causes this error.

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi @Suvetha Balakrishnan ,

another thing worth exploring as giving the union result an alias.

In an Outsystems setting with SQL Server, it needs an alias, so I don't know if this is also the case for Oracle, but just try and see.

Dorine

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.