I need your advice on a SQL script.
I have a select statement selecting about 35 column from multiple tables with a where clause which is working fine. I need to add a MAX(a.date) to the query but I get the error below which I need to add a group by .
ORA-00937: not a single-group group function
I have added all the 35 columns to the group by and query seems to be ok.
My question is, is there a better way to run the query than to add the 35 columns to the Group By like I have done. In the near future I may need to add additional columns.
Sample query I have:
Select a.column1, a.column2, a.cloumn3, b.column4, b.column5, c.column6,
Case where c.column6 is null then c.column6 =’Y’ else ‘N’ end as test,
where b.column5 = (:p_DATE)