I'm brand spanking new at SQL - tutorials, internet searches, and the help menu aren't helping me with this.
Here's my code:
select distinct GLD_COMPANY,GLD_FISCAL_YEAR,GLD_FISCAL_PERIOD,
acc_acct, acc_sub_acct_level01,GLD_ACCT_KEY,GLD_AMOUNT
from DW_GL_TRANSACTIONS inner join dw_gl_account
on DW_GL_TRANSACTIONS.GLD_ACCT_KEY = dw_gl_account.ACC_ACCT_KEY
Where GLD_company between 4600 and 4620
and GLD_FISCAL_YEAR = 2004
and GLD_FISCAL_PERIOD = 0
and acc_acct < 400000
and (acc_acct <> 323000 and acc_sub_acct_level01 = 0001)
Basically, I need to select records where the (acc_acct) field value is less than 400000. But I don't want to include (acc_acct) records that have a value of 323000 *AND* the value of 0001 from the (acc_sub_acct_level01) field.
I was hoping that I'm using the wrong brackets to separate out this additional "AND" statement component, or not enough, etc.
Thanks in advance!
Here's my code:
select distinct GLD_COMPANY,GLD_FISCAL_YEAR,GLD_FISCAL_PERIOD,
acc_acct, acc_sub_acct_level01,GLD_ACCT_KEY,GLD_AMOUNT
from DW_GL_TRANSACTIONS inner join dw_gl_account
on DW_GL_TRANSACTIONS.GLD_ACCT_KEY = dw_gl_account.ACC_ACCT_KEY
Where GLD_company between 4600 and 4620
and GLD_FISCAL_YEAR = 2004
and GLD_FISCAL_PERIOD = 0
and acc_acct < 400000
and (acc_acct <> 323000 and acc_sub_acct_level01 = 0001)
Basically, I need to select records where the (acc_acct) field value is less than 400000. But I don't want to include (acc_acct) records that have a value of 323000 *AND* the value of 0001 from the (acc_sub_acct_level01) field.
I was hoping that I'm using the wrong brackets to separate out this additional "AND" statement component, or not enough, etc.
Thanks in advance!