I've inherited an Access file in which there is the following query:
SELECT tblItem.Instanc eNo, "PL" &
Left([tblItem].[Label],InStr([tblItem].[Label],"-")-1) AS Parent
FROM tblItem, tblItem AS tblItem_1
WHERE ((("PL" &
Left([tblItem].[Label],InStr([tblItem].[Label],"-")-1))=[tblItem_1].[InstanceNo]));
So the same table is included twice and [InstanceNo] is used as criteria for
[Parent]. I would have thought that the query would return two identical
columns but it doesn't. My brain's not working today, which part of the
plot am I missing?
Many thanks,
Keith. 3 2095
On Thu, 29 Sep 2005 10:50:06 +0100, "Keith"
<ke*********@ba eAWAYWITHITsyst ems.com> wrote: I've inherited an Access file in which there is the following query:
SELECT tblItem.Instanc eNo, "PL" & Left([tblItem].[Label],InStr([tblItem].[Label],"-")-1) AS Parent FROM tblItem, tblItem AS tblItem_1 WHERE ((("PL" & Left([tblItem].[Label],InStr([tblItem].[Label],"-")-1))=[tblItem_1].[InstanceNo]));
So the same table is included twice and [InstanceNo] is used as criteria for [Parent]. I would have thought that the query would return two identical columns but it doesn't. My brain's not working today, which part of the plot am I missing?
I would guess that it lists the Instance and Parent for each Parent
row that exists with respect to any row of the table. So, assume you
have 40 rows in the table. Assume that for a given row, say 39, the
Parent is defined as "PL001"; that is, the Label starts with "001-".
Row 39 is displayed once for each row of the 40 rows where Instance =
"PL001".
If row 39 is defining the parent for Instance number 859 (Instance =
"PL859") as "001" (Label starts with "001-") then list row 39 once for
each row in the table where Instance = "PL001".
mike
Without any JOIN statement, this query matches every record to every other
record, so if you have, say, 10 records in the table, you will get 100
records in the result. However, the WHERE clause limits these, and I think
what happens is as follows:
If all the instance numbers are in the form "PLnn" where nn is a number,
and all the labels are in the form "mm-tt" where mm is another number and tt
is a string,
the 'parent' of PLnn whose label is mm-tt will be PLmm,
and this is what the query shows you.
Of course I don't know what your application does, and I might be completely
wrong.
HTH
David
"Keith" <ke*********@ba eAWAYWITHITsyst ems.com> wrote in message
news:43******** **@glkas0286.gr eenlnk.net... I've inherited an Access file in which there is the following query:
SELECT tblItem.Instanc eNo, "PL" & Left([tblItem].[Label],InStr([tblItem].[Label],"-")-1) AS Parent FROM tblItem, tblItem AS tblItem_1 WHERE ((("PL" &
Left([tblItem].[Label],InStr([tblItem].[Label],"-")-1))=[tblItem_1].[Instanc
eNo])); So the same table is included twice and [InstanceNo] is used as criteria
for [Parent]. I would have thought that the query would return two identical columns but it doesn't. My brain's not working today, which part of the plot am I missing?
Many thanks, Keith.
"David Mann" <dm***@ic24.net > wrote in message
news:IC******** *******@newsfe1-win.ntli.net... If all the instance numbers are in the form "PLnn" where nn is a number, and all the labels are in the form "mm-tt" where mm is another number and tt is a string, the 'parent' of PLnn whose label is mm-tt will be PLmm, and this is what the query shows you.
Thanks David and thanks to Mike too. I think I'm beginning to understand it
now. Cheers!
Keith. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: lkrubner |
last post by:
I have a webserver through Rackspace. I create a domain. I create an
FTP user. I upload some files. I create a database called
testOfSetupScript and then I create a database user named setup.
I write some PHP code which should, I think, be able to to auto create
the tables.
The SQL looks like this:
|
by: Dan V. |
last post by:
Situation:
I have to connect with my Windows 2000 server using VS.NET 2003 and C# and
connect to a remote Linux server at another company's office and query their
XML file. Their file may be updated every hour or so. How can I do this
easily? I would like to use secure communication even encryption if
possible. I would query and insert locally only the newest records found in
that XML file to an xml or MS access db.
|
by: Paul |
last post by:
HI! I get an error with this code.
<SCRIPT language="JavaScript">
If (ifp==""){
ifp="default.htm"}
//--></SCRIPT>
Basicly I want my iframe to have a default page if the user enters in
directly. so I need a way doing this. so I check to see if the ifp value is
null and if so then assign it a value. is this correct?
|
by: khan |
last post by:
SELECT Products.Manufacturere, Products.ProductDescription,
Products.SerialNumber, Products.QtyOnHand, Products.Location
FROM Products
WHERE
(((Products.Manufacturere)=!!) AND
((Products.SerialNumber)=!!));
cboSerial and cboManufacturer are combobox on my frmProducts I want
when user select values in both combo box then he should be able to run
query in the base of both combo box vale. but its not doing any thing.
|
by: Bob |
last post by:
Hallo,
I have to make a web application in Javascript/ASP for tenniscourt
reservation (based on Access database). I would like to do everything with
one page, because the user must be able to change his day, hour or
tenniscourt choice before really reserving it . I tried like this:
The first SELECT contains the date (next 30 days) and is filled dynamically.
No problem.
When the date is chosen (by clicking), the second SELECT must...
| |
by: darrel |
last post by:
I'm still struggling to find out why I keep getting
Invalid object name 'monkey'.
errors. Below is my try/catch statement. Note the first query is trying to
delete a record in the table MONKEY. If I omit this, it performs the second
query just fine, but it always hang on this first one.
I've copied this MONKEY table into a new, differently named table, but still
get the same error. I can run this query within Enterprise manager, and...
|
by: webandwe |
last post by:
Hi,
My script lets you choose if you want to view table 1 or table 2 in mysql after you selected 1 or 2 from the drop down menu and press submit.
The problem is if you run the script for the very first time it gives an error at the query. cause no one has told the code where to go and look.
How can I make it so it does not run the script before you click submit or have it select and display the first table until your select?
Here my...
|
by: HarryW |
last post by:
Hio,
I want to update teh database Slim98 with some values out of database Slim0.
The databasestructure is equal.
update Slim98.dbo.article
set Slim98.dbo.article.insuranceinventory = Slim0.dbo.article.insuranceinventory,
Slim98.dbo.article.overwriteBufferStock = Slim0.dbo.article.overwriteBufferStock,
Slim98.dbo.article.insInvDateSet = Slim0.dbo.article.insInvDateSet
where Slim98.dbo.article.code = Slim0.dbo.article.code and...
|
by: ATS |
last post by:
Hi,
I, and some collegues of mine, are running into a weird problem with
Access 2003. If I want to define a new query (or want to add a table
or query to an existing query), Access shows a dialog with three tabs:
Tables, Queries and Both (the exact names may be off, I am using a
Dutch version of Access). From this dialog, you can select the tables
and queries to use in your new query. However, the problem is that
switching the tabs does...
|
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: 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: 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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: 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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |