Download the Tom's Hardware App from the App Store
The reference for current tech news
Yes No
Tom's Hardware > Forum > Applications > Programming > Help With Minus Statement (difference Between Tables)

Help With Minus Statement (difference Between Tables)

Forum Applications : Programming Help With Minus Statement (difference Between Tables)

Word :    Username :           
 

Hi everyone,
I got a problem translating a query from Oracle to Access 2010 because I don't know how to write the 'MINUS'.
I have to do the difference between two tables and I've tried using a 'LEFT JOIN' but I don't get the same result.

Basically, given two input values, the query has to show me a table with all the differences between these two tables.
Now I have this query:

SELECT value1, value2, value3, ...
FROM Table1 LEFT JOIN Table2
ON Table1.CODE = Table2.CODE
WHERE Table1.oldcode=[Please provide the oldcode:] AND Table2.newcode=[Please provide the newcode:]

As a result I get a table with more than 1.000 records but I'm expecting a table with 4 records.
Using the 'MINUS' statement on Oracle it works properly.

How can I do it?

Thank you

Reply to CelloBass
Register or log in to remove.

Access isn't really designed to be SQL'ed...

You should be able to at least do some sort of sub-query with a comparison against it. Not in, or <> or something.

SELECT * FROM sometable LEFT JOIN USING (joinclause)
WHERE sometable.selector = selection AND
someothertable.negative <> (SELECT negative FROM someothertable WHERE someothertable.negativeselector = 'Boo');

Not sure of the exact syntax that it would be in ACCESS though.

Reply to totalknowledge
Tom's Hardware > Forum > Applications > Programming > Help With Minus Statement (difference Between Tables)
Go to:

There are 481 identified and unidentified users. To see the list of identified users, Click here.

  • Ask the community now
  • Publish
Ad
Latest best answer
US
By oldmangamer_73, 92 days ago:

Of course it's possible. I believe you must be US citizen though. I would begin a...

Best offers
They won a badge
Join us in greeting them