KERDEM
|
| Posted: 03/24/2003, 4:18 AM |
|
HI
I AM BEGINNER AND
I CANNNOT CREATE SQL STATEMENT WITH "GROUP BY" OPTION WITH ORACLE 9i AND JSP
I AM GETTING THIS EXCEPTION
" ORA-00907: Rechte Klammer fehlt"
FOR EXAMPLE
SELECT INVOICEDATE,SUM(REVENUE) FROM CIS_INVOICE WHERE INVOICEDATE = '20.02.2003' GROUP BY INVOICEDATE
DO YOU KNOW HOW I CAN SOLVE THIS PROBLEM
|
|
|
 |
george
|
| Posted: 03/24/2003, 11:11 AM |
|
SELECT SUM(REVENUE)
FROM CIS_INVOICE
WHERE INVOICEDATE = '20.02.2003'
should give you a SUM for this group - WHERE INVOICEDATE = '20.02.2003'
If you have had sub-groups like TYPE then you'd want to use Group By
SELECT TYPE, SUM(REVENUE)
FROM CIS_INVOICE
WHERE INVOICEDATE = '20.02.2003'
GROUP BY TYPE
|
|
|
 |
WYWY
|
| Posted: 04/12/2003, 9:12 AM |
|
you should include all the thing you select in the select statement
eg.
SELECT INVOICEDATE,SUM(REVENUE)
FROM CIS_INVOICE
WHERE INVOICEDATE = '20.02.2003'
GROUP BY INVOICEDATE , SUM(REVENUE)
|
|
|
 |
RonB
|
| Posted: 04/13/2003, 3:07 AM |
|
The erro says the right ) is missing, since your example sql doesn't contain ( or ) I assume it's something created by the other code you've written. Your sql statement should work. You should include al fields that are not worked over by some function, for example:
select bla, blabla, blablabla, sum(you_get_the_picture) from table
group by bla, blabla, blablabla
since in your statement invoicedate is the only field besides the sum function it is correct. So look in the rest of your code because appearantly there is a ( that's added without the closing )
The other tning that strikes me is the way you format the date. depending on the nls setting of oracle it could be the . in the dateformat might be confusing oracle. Your error comes back in German. I do believe the european date format in oracle is '20-02-2003'. Try it and maybe it will make all the diference.
Ron
|
|
|
 |
|