Hello,
I'm not an expert in SQL, if you could help me for that little
problem:
I had tree simple tables with their fields:
[Client] IdClient, Param
[Sale] IdSale, IdClient, Param
[Param] IdParam, Value
How can I retrieve a recordset with this columns ?
IdClient, IdSale, ValueOfParamCli ent, ValueOfParamSal e
The problem is that I can retrieve a Param for one table (Client or
Sale) like this request :
SELECT Client.IdClient , Sale.IdSale, Param.Value
FROM
(Client
INNER JOIN Sale
ON Sale.IdClient = Client.IdClient )
LEFT JOIN Param
ON Param.IdParam = Sale.Param
But how can I retrieve the Param of the another table in a simple
query ? (because I would also like that it works for access)
Thank for your help,
Marc 4 1300
"Marc" <pa*******@free .fr> wrote in message
news:pk******** *************** *********@4ax.c om... Hello,
I'm not an expert in SQL, if you could help me for that little problem:
I had tree simple tables with their fields: [Client] IdClient, Param [Sale] IdSale, IdClient, Param [Param] IdParam, Value
How can I retrieve a recordset with this columns ? IdClient, IdSale, ValueOfParamCli ent, ValueOfParamSal e
The problem is that I can retrieve a Param for one table (Client or Sale) like this request :
SELECT Client.IdClient , Sale.IdSale, Param.Value FROM (Client INNER JOIN Sale ON Sale.IdClient = Client.IdClient ) LEFT JOIN Param ON Param.IdParam = Sale.Param
But how can I retrieve the Param of the another table in a simple query ? (because I would also like that it works for access)
Thank for your help,
Marc
It's not really clear - at least to me - what you're trying to do. It would
be best to post CREATE TABLE and INSERT statements to set up a test case,
along with the results you expect, as that will avoid confusion. http://www.aspfaq.com/etiquette.asp?id=5006
Simon
On Fri, 14 Jan 2005 10:26:16 +0100, Marc wrote: Hello,
I'm not an expert in SQL, if you could help me for that little problem:
I had tree simple tables with their fields: [Client] IdClient, Param [Sale] IdSale, IdClient, Param [Param] IdParam, Value
How can I retrieve a recordset with this columns ? IdClient, IdSale, ValueOfParamCli ent, ValueOfParamSal e
The problem is that I can retrieve a Param for one table (Client or Sale) like this request :
SELECT Client.IdClient , Sale.IdSale, Param.Value FROM (Client INNER JOIN Sale ON Sale.IdClient = Client.IdClient ) LEFT JOIN Param ON Param.IdParam = Sale.Param
But how can I retrieve the Param of the another table in a simple query ? (because I would also like that it works for access)
Hi Marc,
Something like this maybe?
SELECT C.IdClient, S.IdSale, PC.Value, PS.Value
FROM Client AS C
INNER JOIN Sale AS S
ON S.IdClient = C.IdClient
INNER JOIN Param AS PC
ON PC.IdParam = C.Param
INNER JOIN Param AS PS
ON PS.IdParam = S.Param
(untested)
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
On Fri, 14 Jan 2005 12:10:39 +0100, Hugo Kornelis
<hugo@pe_NO_rFa ct.in_SPAM_fo> wrote: On Fri, 14 Jan 2005 10:26:16 +0100, Marc wrote:
Hello,
I'm not an expert in SQL, if you could help me for that little problem:
I had tree simple tables with their fields: [Client] IdClient, Param [Sale] IdSale, IdClient, Param [Param] IdParam, Value
How can I retrieve a recordset with this columns ? IdClient, IdSale, ValueOfParamCli ent, ValueOfParamSal e
The problem is that I can retrieve a Param for one table (Client or Sale) like this request :
SELECT Client.IdClient , Sale.IdSale, Param.Value FROM (Client INNER JOIN Sale ON Sale.IdClient = Client.IdClient ) LEFT JOIN Param ON Param.IdParam = Sale.Param
But how can I retrieve the Param of the another table in a simple query ? (because I would also like that it works for access)
Hi Marc,
Something like this maybe?
SELECT C.IdClient, S.IdSale, PC.Value, PS.Value FROM Client AS C INNER JOIN Sale AS S ON S.IdClient = C.IdClient INNER JOIN Param AS PC ON PC.IdParam = C.Param INNER JOIN Param AS PS ON PS.IdParam = S.Param
(untested)
Best, Hugo
Thanks very much Hugo !
I can only test on access today and it works with a few changes (I'll
test later on SqlServer)
For information, the code that works with access :
SELECT Client.IdClient , Sale.IdSale, PC.Value, PS.Value
FROM ((Client
INNER JOIN Sale
ON Sale.IdClient = Client.IdClient )
INNER JOIN Param AS PC
ON PC.IdParam = Client.Param)
INNER JOIN Param AS PS
ON PS.IdParam = Sale.Param
Marc
You also need to alias your columns:
SELECT Client.IdClient , Sale.IdSale, PC.Value AS PC_Param_Value, PS.Value
as AS PS_Param_Value
FROM ((Client
INNER JOIN Sale
ON Sale.IdClient = Client.IdClient )
INNER JOIN Param AS PC
ON PC.IdParam = Client.Param)
INNER JOIN Param AS PS
ON PS.IdParam = Sale.Param
This gives you the ability to differentiate between the vaues when you are
using the result set.
--
----------------------------------------------------------------------------
Louis Davidson - dr***@hotmail.c om
SQL Server MVP
Compass Technology Management - www.compass.net
Pro SQL Server 2000 Database Design - http://www.apress.com/book/bookDisplay.html?bID=266
Note: Please reply to the newsgroups only unless you are interested in
consulting services. All other replies may be ignored :)
"Marc" <pa*******@free .fr> wrote in message
news:o6******** *************** *********@4ax.c om... On Fri, 14 Jan 2005 12:10:39 +0100, Hugo Kornelis <hugo@pe_NO_rFa ct.in_SPAM_fo> wrote:
On Fri, 14 Jan 2005 10:26:16 +0100, Marc wrote:
Hello,
I'm not an expert in SQL, if you could help me for that little problem:
I had tree simple tables with their fields: [Client] IdClient, Param [Sale] IdSale, IdClient, Param [Param] IdParam, Value
How can I retrieve a recordset with this columns ? IdClient, IdSale, ValueOfParamCli ent, ValueOfParamSal e
The problem is that I can retrieve a Param for one table (Client or Sale) like this request :
SELECT Client.IdClient , Sale.IdSale, Param.Value FROM (Client INNER JOIN Sale ON Sale.IdClient = Client.IdClient ) LEFT JOIN Param ON Param.IdParam = Sale.Param
But how can I retrieve the Param of the another table in a simple query ? (because I would also like that it works for access)
Hi Marc,
Something like this maybe?
SELECT C.IdClient, S.IdSale, PC.Value, PS.Value FROM Client AS C INNER JOIN Sale AS S ON S.IdClient = C.IdClient INNER JOIN Param AS PC ON PC.IdParam = C.Param INNER JOIN Param AS PS ON PS.IdParam = S.Param
(untested)
Best, Hugo
Thanks very much Hugo ! I can only test on access today and it works with a few changes (I'll test later on SqlServer)
For information, the code that works with access : SELECT Client.IdClient , Sale.IdSale, PC.Value, PS.Value FROM ((Client INNER JOIN Sale ON Sale.IdClient = Client.IdClient ) INNER JOIN Param AS PC ON PC.IdParam = Client.Param) INNER JOIN Param AS PS ON PS.IdParam = Sale.Param
Marc This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bernie |
last post by:
Greetings,
I have 3 servers all running SQL Server 2000 - 8.00.818. Lets call
them parent, child1, and child 2.
On parent, I create a view called item as follows:
CREATE view Item as
select * from child1.dbchild1.dbo.Item union all
select * from child2.DBChild2.dbo.Item
|
by: JMCN |
last post by:
hi
i need some advice on whether if it would be better to use an append
query or an update query. here is the situation, i have linked another
database table to my current database. then i created a query for the
linked database but eventually i need to have this query to be
constantly updated and append to another table in the current
database. i hope i'm not too vague but i have no idea if i should use
an update or an append query....
|
by: G rumpy O ld D uffer |
last post by:
This is probably a 'Low-Level' question to all the ACCESS experts but
I've only been using ACCESS for a couple of weeks.
I've been given 30+ (and counting) separate 'Weekly' Databases which
all have a Table, in exactly the same Field format, in each of these
'Weekly' DataBases.
I want to set-up a new 'Master' Database, so that I can write one
Query to search all the 'Weekly' Databases and produce one new Table
in the 'Master' Database...
|
by: dk |
last post by:
Hi all,
Would appreciate some advice on the following:
I am trying to speed up an Access database connected to a SQL Server
back-end. I know I can use a pass-through query to pass the sql code
directly to SQL Server and speed things up.
However, I want to be able to "filter" or place conditions on which records
to retrieve based on LOCAL tables in Access.
|
by: deko |
last post by:
How to run action query against linked table?
I have an Access 2003 mdb with an Excel 2003 Workbook as a linked table.
When I attempt to run an action query against the linked table I get this
error:
Deleting data in a linked table is not supported by this ISAM.
From what I understand, indexed sequential access method (ISAM) drivers are
used to update "non-Microsoft" file formats. So why doesn't Access
| |
by: Marizel |
last post by:
I'm not sure there's an easy solution to this, but thought I'd ask. I
often find myself with a query which I'd like to reuse, but with a
different datasource. These datasources generally have identical
field names. The queries select a subset of the fields, so "Select *"
is not really an option.
Is there an easy way to change the source of a query, either in the
design grid or SQL display? I suppose I could copy the SQL into
WordPad...
|
by: mattytee123 |
last post by:
I have about 20 tables, of which I would like to do a union query and
count of how many of each different code there is?
The simplified verson of the table is structured like this.
Code Count
1234 1
2468 1
1234 1
2468 1
|
by: lesperancer |
last post by:
SELECT distinct b.t_orno, b.t_pono
FROM tblMonthlyBooking AS b, tblFilterDate, tblFilterDate AS
tblFilterDate_1
WHERE (((b.t_yearMonth) Between . And
.));
tblMonthlyBooking is a sql server table, 200K rows, yearMonth is an
indexed long integer
the primary key is t_orno, t_pono
|
by: jonceramic |
last post by:
Hi All,
I started developing in Access, and people took notice and so we're
starting to migrate into our corporate's bigger Oracle system.
I'll still be using my developed Access front ends, but will be
migrating my back ends to Oracle ODBC.
1. Does anyone have recommendations for books or web resources for
general rules/guidelines/help on doing this? I haven't found a good
|
by: Sinner |
last post by:
Hi,
I have a field name 'USER' in tableMAIN.
How do I replace the user names with corresponding user names. I can
do that in xl using vlookup but now I'm trying to find a way to do
that in access.
For a user mismatch, it should give NA
Thx.
|
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: 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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |