G'day all,
I'm trying to update a single table (containing plans for flights) with information from the same and other tables (containing info for organisations and locations).
tblFlightPlans contains the txt-column 'TripSummary', which is what I'm trying to update, as well as ID numbers for the origin, destination, and plane carrier (eg, Qantas). The SQL code below successfully joins tblLocations and tblFlightPlans and updates TripSummary with a text name for the flight's origin. -
UPDATE [SELECT PlaceID, PlaceName FROM tblLocations]. AS test INNER JOIN tblFlightPlans ON test.PlaceID=tblFlightPlans.Leg1Origin SET TripSummary = test.PlaceName;
-
What I need is something very similar, but involving the above TWICE (two lookups), for an origin and a destination, as well as a carrier. I've tried this, which fails: -
UPDATE
-
[SELECT PlaceID, PlaceName FROM tblLocations]. AS Origins INNER JOIN tblFlightPlans ON Origins.PlaceID=tblFlightPlans.Leg1Origin
-
[SELECT PlaceID, PlaceName FROM tblLocations]. AS Destinations INNER JOIN tblFlightPlans ON Destinations.PlaceID=tblFlightPlans.Leg1Dest
-
[SELECT OrgID, Name FROM tblOrganisations]. AS Carriars INNER JOIN tblFlightPlans ON Carriars.OrgID=tblFlightPlans.Leg1OrgID
-
-
SET TripSummary = Origins.PlaceName & " to " & Destinations.PlaceName & " by " Carriars.Name;
-
...and also this, which also fails (though again, the singular form works, if I'm only trying to update TripSummary with one PlaceName): -
UPDATE tblFlightPlans
-
INNER JOIN [SELECT PlaceID, PlaceName FROM tblLocations]. AS Origins ON Origins.PlaceID=tblFlightPlans.Leg1Origin
-
INNER JOIN [SELECT PlaceID, PlaceName FROM tblLocations]. AS Destinations ON Destinations.PlaceID=tblFlightPlans.Leg1Dest
-
INNER JOIN [SELECT OrgID, Name FROM tblOrganisations]. AS Carriars ON Carriars.OrgID=tblFlightPlans.Leg1OrgID
-
-
SET TripSummary = Origins.PlaceName & " to " & Destinations.PlaceName & " by " Carriars.Name;
-
What am I doing wrong? How do I approach using multiple joins in Access?
If all else fails, is there some sort of "append" function that will allow me to make 3 separate queries and tack it on to the same textbox?
Notes:
Interchanging "(xxx) AS x" and "[xxx]. AS x" gives the same errors, so I don't think it's a bracketing problem. Also, "Carriars" is deliberate, the name "Carriers" is already taken somewhere else =P
3 2263
UPDATE: Apparrently there is such a thing as 'nested INNER JOINs'. Looking into these now, but they're pretty obtuse beasts.
UPDATE: Nevermind, all, got it sorted! =)
The following does what I want, ie, gives a text output of "Location1 to Location2 by Carrier1". -
UPDATE
-
[SELECT PlaceID, PlaceName FROM tblLocations]. AS Origins INNER JOIN
-
(
-
[SELECT PlaceID, PlaceName FROM tblLocations]. AS Destinations INNER JOIN
-
(
-
tblFlightPlans INNER JOIN [SELECT OrgID, Name FROM tblOrganisations]. AS Carriars ON Carriars.OrgID=tblFlightPlans.Leg1OrgID
-
)
-
ON Destinations.PlaceID=tblFlightPlans.Leg1Dest
-
)
-
ON Origins.PlaceID=tblFlightPlans.Leg1Origin
-
-
SET TripSummary = Origins.PlaceName & " to " & Destinations.PlaceName & " by " & Carriars.Name;
-
NeoPa 32,566
Recognized Expert Moderator MVP
Just to assuage your curiosity about the subquery notation, see Access QueryDefs Mis-save Subquery SQL.
Note, in most cases (except those where it seems Access recognises that it was created by itself) only the version with parentheses will be recognised.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Peter |
last post by:
I run most of my SQL scripts via kornshell on AIX.
I use the "here-document" to run some of the smaller ones.
Example:
#!/bin/ksh
# Analyze the table.
sqlplus ${SCHEMA_NM}/${SCHEMA_PASSWD}@${DB_NM} <<-ANALYZE_TABLE
SET TERMOUT ON
|
by: Peter |
last post by:
I've purchased VS.NET 2005 Standard and have tried to install SQL Server
2005 Express, but get the following error in the error log.
Please could someone help me....
Microsoft SQL Server 2005 Express Edition x86:
Component Microsoft SQL Server 2005 Express Edition x86 returned an
unexpected value.
***EndOfSession***? Microsoft SQL Server 2005 Express
Edition x86: Component Microsoft SQL Server 2005 Express Edition x86
returned an...
|
by: Anns via SQLMonster.com |
last post by:
My company currently has about 20-25 Ms Access Database that they want to
replace the FE with .net and the BE on SQL.
This will be done using Visual Studio 2005. Once the FE is converted to .net
and the BE is SQL they all will be accessed through our intranet (sharepoint).
I work in Ms Access and intermediate at VBA and just learing SQL through the
ENTERPRISE MANAGER SCREEN.
|
by: Fuzzydave |
last post by:
I am back developing futher our Python/CGI based web application run by
a Postgres DB
and as per usual I am having some issues. It Involves a lot of Legacy
code. All the actual
SQL Querys are stored in the .py files and run in the .cgi files. I
have the problem that I
need to construct a row from two seprate SQL Querys, I have tried
combining the two
Querys but all that does is create a Query that returns nothing after a
long period...
|
by: Developer |
last post by:
Hello All,
i have recently installed VS2005 and was trying to install SQL sever
2000.
I have Win XP' SP2. But when I tried installing, it only installed
client tools and not the database.
Can anyone please help me with this as I want to install SQL server and
also wouold be grateful, if you can suggest me any workaround to
dealwith this problem.(Like should I install any new OS etc).
Any help would be appreciated.
| |
by: HC |
last post by:
I posted this in one of the VB forums but I'm starting to think it
might be more appropriate to have it here, since it really seems to be
a SQL server (MSDE/Express 2005) problem:
Hey, all, I have a problem with queries against a SQL server instance
that I just found and is causing me fits. I hope someone can point
me
in the right direction, please. TIA.
Basically, I got a Vista OS machine to test my VB6 app on it as some
|
by: Steve |
last post by:
Hi All
I downloaded Sql server 2005 express SP2 and attempted to modify the
Bootstrapper package files as I did with SP1
When i try to install SQL server as part of my VS 2005 deployment app I get
an error at the end of the SQL server install phase 'Invalid endpoint'.
(Note SQL server express gets installed OK)
If I run SQL server express SP2 setup directly it I don't get the error
|
by: fniles |
last post by:
I would like to copy a table(s) from SQL Server 2005 to a CVS file and vice
versa.
I was thinking to use the BCP command line utility, but I have a few
questions:
1. The machine where I am going to run BCP utility does not have SQL Server
installed, so BCP.exe and its underlying DLLs are not there.
I copied BCP.EXE, then it tells me that it expects sqlncli.dll. After I
copied that DLL, it now says "Unable to load BCP resource DLL. BCP...
|
by: Mike1961 |
last post by:
Hi there.
Well the situation is this, I have two tables:
1) tbl_registry where rows with code = 123 are 35 ;
1) tbl_Registered where rows with code = 123 are 43
In tbl_Registered I have it 7 rows more respect tbl_registry can you tell my why I have this situation:
|
by: Frinavale |
last post by:
SQL Injection Attack
A database is a collection of information organised in such a way that allows computer programs to access data (even large amounts) quickly and easily. Data within a database is organised into tables, which contain records/rows of fields. A field contains the actual data used by the program.
Relational Database Management Systems (RDBMS or sometimes just DBMS) allow users the ability to access and manipulate data within...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |