473,394 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Does ACCESS have the MINUS keyword

ACCESS says there is a syntax error in this statement. I am trying to
find out which records are not in the second table.

SELECT Charges.ID, Charges.Total
FROM Charges
MINUS
SELECT Invoice_Details.ChargeID AS ID, Invoice_Details.Amount As Total
FROM Invoice_Details;

Can I do this in Access? If not, is there a way to get the result
that I am looking for?

Thanks.
Nov 13 '05 #1
3 47493
David wrote:
ACCESS says there is a syntax error in this statement. I am trying to
find out which records are not in the second table.

SELECT Charges.ID, Charges.Total
FROM Charges
MINUS
SELECT Invoice_Details.ChargeID AS ID, Invoice_Details.Amount As Total
FROM Invoice_Details;

Can I do this in Access? If not, is there a way to get the result
that I am looking for?


JET SQL (the DB Engine behind Access) does not support the MINUS keyword. You might be
able to use the WHERE .. NOT IN clause:

SELECT GameDate FROM SportsEvents
WHERE GameDate NOT IN (SELECT SpecialOfferDate FROM EventPromotions)
--
'---------------
'John Mishefske
'---------------
Nov 13 '05 #2
"John Mishefske" <jm**********@SPAMyahoo.com> wrote in message
news:zy*******************@tornado.rdc-kc.rr.com...
David wrote:
ACCESS says there is a syntax error in this statement. I am trying to
find out which records are not in the second table.

SELECT Charges.ID, Charges.Total
FROM Charges
MINUS
SELECT Invoice_Details.ChargeID AS ID, Invoice_Details.Amount As Total
FROM Invoice_Details;

Can I do this in Access? If not, is there a way to get the result
that I am looking for?


JET SQL (the DB Engine behind Access) does not support the MINUS keyword.
You might be able to use the WHERE .. NOT IN clause:

SELECT GameDate FROM SportsEvents
WHERE GameDate NOT IN (SELECT SpecialOfferDate FROM EventPromotions)


Alternatively, try using a LEFT JOIN:

SELECT Charges.ID, Charges.Total
FROM Charges LEFT JOIN Invoice_Details
ON Charges.ID = Invoice_Details.ChargeID
WHERE Invoice_Details.ChargeID = Null

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

Nov 13 '05 #3
Douglas J. Steele wrote:
"John Mishefske" <jm**********@SPAMyahoo.com>

JET SQL (the DB Engine behind Access) does not support the MINUS keyword.
You might be able to use the WHERE .. NOT IN clause:

SELECT GameDate FROM SportsEvents
WHERE GameDate NOT IN (SELECT SpecialOfferDate FROM EventPromotions)

Alternatively, try using a LEFT JOIN:

SELECT Charges.ID, Charges.Total
FROM Charges LEFT JOIN Invoice_Details
ON Charges.ID = Invoice_Details.ChargeID
WHERE Invoice_Details.ChargeID = Null


Which will definitely perform better than the 'NOT IN' suggestion I made where the tables
can be related. Thanks Douglas.

--
'---------------
'John Mishefske
'---------------
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Juho Saarikko | last post by:
The program attached to this message makes the Python interpreter segfault randomly. I have tried both Python 2.2 which came with Debian Stable, and self-compiled Python 2.3.3 (newest I could find...
1
by: Bibic0711 | last post by:
I am having problem on following situation, any comments are welcome. I have this table A which contents most of the data, that needs to be query based on a name field in table B and was linked...
3
by: Mark | last post by:
I am a novice with Access, and it appears to me that I will need to write a fair amount of VBscript to do anything complex. And since I will be writing VB code, I am wondering what benefits...
17
by: Hazz | last post by:
In this sample code of ownerdraw drawmode, why does the '(ComboBox) sender' line of code need to be there in this event handler? Isn't cboFont passed via the managed heap, not the stack, into this...
21
by: Niu Xiao | last post by:
I see a lot of use in function declarations, such as size_t fread(void* restrict ptr, size_t size, size_t nobj, FILE* restrict fp); but what does the keyword 'restrict' mean? there is no...
2
by: yaso2com | last post by:
hi every body hope u r fine i would like to write this selest statement which is in SQL to the Access but i couldnt could any one give me a hint how can i do that ? select * from t minus ...
2
by: CenturionX | last post by:
Hello everybody i'm trying to use the minus operator like that: (SELECT DISTINCT TRIM(S.Lname & ', ' & Fname) AS Name, S.SID FROM Salesperson as S, Schedule as H WHERE S.SID = H.SID AND H.Day =...
2
by: Shalini Bhalla | last post by:
I want to extract records form a table . I have Table A and Table B . I want to extract unmatching records from table A to table B .... Can you Please tell me how to extrat it ? How to...
162
by: Sh4wn | last post by:
Hi, first, python is one of my fav languages, and i'll definitely keep developing with it. But, there's 1 one thing what I -really- miss: data hiding. I know member vars are private when you...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.