I've created a script to retrieve data from 4 tables: TX30000, SOP30200, SOP30300, and GL00100. I'm getting close to what I want but even with using 'select distinct' I'm getting duplicate rows. the below example displays data retrieved that represents one Invoice(22793) in the amount of 850.00 with two line items relating to two tax schedules with distinct distribution accounts. What I would like to retrieve is in the second section of information.
Data that is being retrieved:
Inv # TaxID DocAmt TaxAmt DistAcct
22793 LOCAL 850.00 19.12 4651
22793 LOCAL 850.00 19.12 4657
22793 STATE 850.00 59.50 4651
22793 STATE 850.00 59.50 4657
Data that I would like to retrieve:
22793 LOCAL 850.00 19.12 4657
22793 STATE 850.00 59.50 4651
Following is the script:
SELECT
DISTINCTTX30000
.DOCDATE AS Document_Date, TX30000.CustomerVendor_ID AS Customer,TX30000
.DOCNUMBR AS Invoice_#, TX30000.TAXDTLID AS Tax_ID,TX30000
.DOCAMNT AS Document_Amount, TX30000.TAXABLE_AMOUNT AS Taxable_Amount,TX30000
.TAXAMNT AS Tax_Amount, SOP30200.FRTAMNT AS Freight_Amt,SOP30300
.LOCNCODE AS Site, GL00100.ACTNUMBR_1 AS Location,GL00100.ACTNUMBR_2 AS Main_Account FROM TX30000LEFT JOIN SOP30300 ON TX30000.DOCNUMBR = SOP30300.SOPNUMBE LEFT JOIN SOP30200 ON SOP30200.SOPNUMBE = SOP30300.SOPNUMBELEFT JOIN GL00100 ON GL00100.ACTINDX = SOP30300.SLSINDX WHERE TX30000.DOCDATE > '2009-01-01'Any help would be appreciated!
Debi
*This post is locked for comments