Ask the Expert

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:

    Requires Free Membership to View

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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: