473,382 Members | 1,107 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,382 software developers and data experts.

Need help with OLEDB query expression

I need to get information from 3 tables in an MDB file.

I need all the columns in the first table.
I need 2 columns in the 2nd table where it's primary key matches a
column in the first table.
I need several columns in the 3rd table where it's primary key matches a
column in the 2nd table.

I tried this:

SELECT calPackage.*,calShipment.m_shipDateTime,
calShipment.m_foreignKey00,calPkgAgent.m_residenti al,
calPkgAgent.m_StreetAddress,calPkgAgent.m_City,
calPkgAgent.m_StateProv,calPkgAgent.m_Country,
calPkgAgent.m_PostalCode,calPkgAgent.m_RoomFloor,
calPkgAgent.m_Department,calPkgAgent.m_Attention,
calPkgAgent.Sm_businessName
FROM calPackage
INNER JOIN calShipment
ON calShipment.m_primaryKey=calPackage.m_foreignKey
INNER JOIN calPkgAgent
ON calPkgAgent.m_primaryKey=calShipment.m_foreignKey0 0

but when I tried to execute the command, I get:

Syntax error (missing operator) in query expression
'calShipment.m_primaryKey=calPackage.m_foreignKey INNER JOIN calPkgAgent
ON calPkgAgent.m_primaryKey=calShipment.m_foreignKey0 0'.

I'm looking for any help I can get. Thanks!

*** Sent via Developersdex http://www.developersdex.com ***
Feb 1 '06 #1
2 4820
I think you'll get your answer by posting your question here:
microsoft.public.access.queries

"Terry Olsen" <to******@hotmail.com> wrote in message
news:uk**************@tk2msftngp13.phx.gbl...
I need to get information from 3 tables in an MDB file.

I need all the columns in the first table.
I need 2 columns in the 2nd table where it's primary key matches a
column in the first table.
I need several columns in the 3rd table where it's primary key matches a
column in the 2nd table.

I tried this:

SELECT calPackage.*,calShipment.m_shipDateTime,
calShipment.m_foreignKey00,calPkgAgent.m_residenti al,
calPkgAgent.m_StreetAddress,calPkgAgent.m_City,
calPkgAgent.m_StateProv,calPkgAgent.m_Country,
calPkgAgent.m_PostalCode,calPkgAgent.m_RoomFloor,
calPkgAgent.m_Department,calPkgAgent.m_Attention,
calPkgAgent.Sm_businessName
FROM calPackage
INNER JOIN calShipment
ON calShipment.m_primaryKey=calPackage.m_foreignKey
INNER JOIN calPkgAgent
ON calPkgAgent.m_primaryKey=calShipment.m_foreignKey0 0

but when I tried to execute the command, I get:

Syntax error (missing operator) in query expression
'calShipment.m_primaryKey=calPackage.m_foreignKey INNER JOIN calPkgAgent
ON calPkgAgent.m_primaryKey=calShipment.m_foreignKey0 0'.

I'm looking for any help I can get. Thanks!

*** Sent via Developersdex http://www.developersdex.com ***

Feb 2 '06 #2

You need to put the first join within a set of parenthesis:

SELECT calPackage.*,calShipment.m_shipDateTime,
calShipment.m_foreignKey00,calPkgAgent.m_residenti al,
calPkgAgent.m_StreetAddress,calPkgAgent.m_City,
calPkgAgent.m_StateProv,calPkgAgent.m_Country,
calPkgAgent.m_PostalCode,calPkgAgent.m_RoomFloor,
calPkgAgent.m_Department,calPkgAgent.m_Attention,
calPkgAgent.Sm_businessName
FROM
(calPackage
INNER JOIN calShipment
ON calShipment.m_primaryKey=calPackage.m_foreignKey)

INNER JOIN calPkgAgent
ON calPkgAgent.m_primaryKey=calShipment.m_foreignKey0 0

--
------------------------------------------------------------------------
George Shubin Custom Software Development
dX Software Systems Database Applications
Ph: 503-981-6806 Fax: 503-982-0120
www.dxonline.com ge****@dxonline.com
------------------------------------------------------------------------

"The sum which two married people owe to one another defies calculation. It
is an infinite debt, which can only be discharged through all eternity." --
Goethe

"Terry Olsen" <to******@hotmail.com> wrote in message
news:uk**************@tk2msftngp13.phx.gbl...
I need to get information from 3 tables in an MDB file.

I need all the columns in the first table.
I need 2 columns in the 2nd table where it's primary key matches a
column in the first table.
I need several columns in the 3rd table where it's primary key matches a
column in the 2nd table.

I tried this:

SELECT calPackage.*,calShipment.m_shipDateTime,
calShipment.m_foreignKey00,calPkgAgent.m_residenti al,
calPkgAgent.m_StreetAddress,calPkgAgent.m_City,
calPkgAgent.m_StateProv,calPkgAgent.m_Country,
calPkgAgent.m_PostalCode,calPkgAgent.m_RoomFloor,
calPkgAgent.m_Department,calPkgAgent.m_Attention,
calPkgAgent.Sm_businessName
FROM calPackage
INNER JOIN calShipment
ON calShipment.m_primaryKey=calPackage.m_foreignKey
INNER JOIN calPkgAgent
ON calPkgAgent.m_primaryKey=calShipment.m_foreignKey0 0

but when I tried to execute the command, I get:

Syntax error (missing operator) in query expression
'calShipment.m_primaryKey=calPackage.m_foreignKey INNER JOIN calPkgAgent
ON calPkgAgent.m_primaryKey=calShipment.m_foreignKey0 0'.

I'm looking for any help I can get. Thanks!

*** Sent via Developersdex http://www.developersdex.com ***

Feb 2 '06 #3

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

Similar topics

6
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
0
by: dim mzeura via .NET 247 | last post by:
(Type your message here) -------------------------------- From: dim mzeura I have the same problem too. Please help! System.Data.OleDb.OleDbException: Syntax error (missing operator) in...
3
by: Brett | last post by:
The first query will run but the second will not: Dim constring As String Dim id As String = "10-03" File.Delete(FilePath & CSVFileName) constring = ("Provider=Microsoft.Jet.OLEDB.4.0;Data...
8
by: luis | last post by:
Hi I'm using activestate python 2.4 on win xp 2 ed. and Ms Access 2002 (reading first http://starship.python.net/crew/bwilk/access.html) I have writed the following code def...
9
by: Blarneystone | last post by:
Hi, I am using VB.NET and trying to pull data from two different tables in the database. I am using what I think is standard code. But the data I am pulling is like the following: Table1...
0
by: nostradumbass77 | last post by:
Using Enterprise Library 2.0 (Jan 06) and .NET 2.0 (VB.Net 2005) Dim dbPF As Data.Common.DbProviderFactory Try dbPF = Data.Common.DbProviderFactories.GetFactory("System.Data.OleDb") db = New...
0
by: CaJack | last post by:
Hi, I’m having trouble with my code and I’m starting to get lost. The Program takes the country that’s been typed in to the textbox and when the query button is clicked the program queries an access...
2
by: psychomad | last post by:
Please, can someone help me out to solve this error, i've been searching throughout my codes and yet i didnt succeed in finding the error!!!! The Error is: Server Error in '/' Application....
2
by: johnmay1248 | last post by:
I am having a problem with queries running in this code When I use the query "SELECT * FROM sample" the code runs and the data grid binds and shows the contents of the sample table. If I change...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.