Q

Query to summarize monthly sales tax collection

I'm trying to summarize monthly sales tax collections using the following query:

SELECT 
    HSE_BASE."RES_STATE_HSE", 
    TAX_FEE_TRAN_BASE."TRAN_DTE_TAX", 
    TAX_FEE_TRAN_BASE."TAX_CDE_TAX", 
    SUM(TAX_FEE_TRAN_BASE."TAX_AMT_TAX") AS TAX 
FROM 
    "OPS$DOM"."HSE_BASE" HSE_BASE, 
    "OPS$DOM"."TAX_FEE_TRAN_BASE" TAX_FEE_TRAN_BASE  
WHERE 
    HSE_BASE."SUB_ACCT_NO_HSE" = TAX_FEE_TRAN_BASE."SUB_ACCT_NO_TAX" AND 
    TAX_FEE_TRAN_BASE."TRAN_DTE_TAX" >= {ts '2003-12-01 00:00:00.00'} AND 
    TAX_FEE_TRAN_BASE."TRAN_DTE_TAX" < {ts '2003-12-31 00:00:01.00'}    
GROUP BY 
   HSE_BASE."RES_STATE_HSE" , 
   TAX_FEE_TRAN_BASE."TAX_CDE_TAX" 
ORDER BY 
    HSE_BASE."RES_STATE_HSE" ASC, 
    TAX_FEE_TRAN_BASE."TAX_CDE_TAX" ASC 

When I run it I get the following error:
ORA-00979: Not a Group By expression.
You must include each column in the column list (following SELECT) in the GROUP BY. You didn't include the TAX_FEE_TRAN_BASE."TAX_DTE_TAX" column. Add this and it will work.

This was first published in March 2004

Dig deeper on Oracle and SQL

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide

SearchDataCenter

SearchContentManagement

SearchFinancialApplications

Close