How is this possible? Access SQL ODBC result

Deruvian

Lord Nagafen Raider
642
116
I am running a query in Access to an odbc linked table.

The query is as such:

SELECT sysdba_SALESORDER.SALESORDERID
FROM sysdba_SALESORDER
WHERE :emoji_nose:sysdba_SALESORDER.SALESORDERID)="QWKHAA01RSFT") );

The result is this:

QWKHAA00F451

To me, this is like 1+1 = 3. This query only exists because I joined this table with another dataset on the SalesOrderID field and the result looked funny so I picked QWKHAA01RSFT to spot check and my result is a completely different ID. How is this possible? The entire clip of data from the original join had given me funky results, I would assume that this would be pervasive if I did more searches.
 

Chancellor Alkorin

Part-Time Sith
<Granularity Engineer>
6,029
5,915
Hmm. How about a dump of the table contents? Any weird constraints on the key? You're right, looks very strange.
 

Deruvian

Lord Nagafen Raider
642
116
For one thing, it is a primary key, but for every order on that account, the order ID will show up as QWKHAA00F451. If I sort by the account ID associated with QWKHAA00F451, and manually use 'find' on sales order ID for QWKHAA01RSFT, nothing shows up, but if I click 'text filter' = 'QWKHAA01RSFT' on the same field, it will return QWKHAA00F451 as the result. Similarly, any of the attributes known to be related to QWKHAA01RSFT will be found in the 'text filter', but they will be displaying the data for QWKHAA00F451 rather than QWKHAA01RSFT.

This appears to be happening for every single account in the table. It's like the query knows where the data I'm looking for actually is, but what it's returning is incorrect.

Could it be some sort of corruption with the table link? I can't imagine that the actual table is behaving this way, as the web interface for the system seems to be returning the correct data for QWKHAA01RSFT.
 

LennyLenard_sl

shitlord
195
1
I don't know SQL very well, but shouldn't it be:

WHERE :emoji_nose:sysdba_SALESORDER.SALESORDERID)='QWKHAA01RSFT') );

with single quote (') as a string you're looking for, not double (")?
 

Deruvian

Lord Nagafen Raider
642
116
Either will work in Access interface; if you were pushing the code through VBA you would need the single quotes.
 

Chancellor Alkorin

Part-Time Sith
<Granularity Engineer>
6,029
5,915
Honestly, it would be best to go into SQL with something that isn't Access and check the validity of the data firsthand. It could be a lot of things at this point and we're kinda lacking insight into the (many) variables. Do you have access to SQL Studio or something?
 

Deruvian

Lord Nagafen Raider
642
116
I have Oracle SQL developer with the right jdbc drivers. I will try when I am at work tomorrow.