Q
Problem solve Get help with specific problems with your technologies, process and projects.

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.

Dig Deeper on Oracle and SQL

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.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close