Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Query Returns Different Results in Access vs Excel?

$
0
0
Hello,

I have a very simple query which returns activity related to a certain product code.

I had realized that certain undesirable test accounts had been creeping into the query, so I isolated them into their own query with the intent of filtering them out of the result set with an outer join. This is where the problem lies.

This this query in Access correctly recognizes when AccountIDs in TestAccts match the AccountID in sysdba_SALESORDER, and will show the accompanying AccountID and AccountName in Access.

My Excel workbook has a table which is linked to this query, but AccountID and AccountName are blank in all cases in this query, even when the AccountID is showing as matching when the same query is run through Access.

Any ideas or help would be appreciated. I was expecting this to be a 5 minute fix and it's taking me all afternoon.

Main Query:

Code:


SELECT sysdba_ACCOUNT.ACCOUNT, sysdba_SALESORDER.PRODUCTACCESSTYPEPATHWAY, sysdba_SALESORDER.MODIFYDATE, sysdba_SALESORDER.CREATEDATE, sysdba_SALESORDER.ORDERTYPE, sysdba_SALESORDER.STATUS, sysdba_SALESORDER.GRANDTOTAL, TestAccts.ACCOUNTID, TestAccts.ACCOUNT

FROM (
          sysdba_SALESORDER INNER JOIN sysdba_ACCOUNT
          ON
          sysdba_SALESORDER.ACCOUNTID = sysdba_ACCOUNT.ACCOUNTID
        ) LEFT JOIN
        TestAccts
          ON sysdba_ACCOUNT.ACCOUNTID = TestAccts.ACCOUNTID
WHERE (((sysdba_SALESORDER.PRODUCTACCESSTYPEPATHWAY)="SSR"));

Contents of TestAccts:

Code:

SELECT sysdba_ACCOUNT.ACCOUNTID, sysdba_ACCOUNT.ACCOUNT
FROM sysdba_ACCOUNT
WHERE (((sysdba_ACCOUNT.ACCOUNT) Like ("*Test *")));

Eric

Viewing all articles
Browse latest Browse all 13329

Trending Articles