473,661 Members | 2,456 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query to consolidate 2 tables?

How can I consolidate these two tables into a single view?

Current:

=TableA=
fldP
fldX

=TableB=
fldY
fldZ

Required:

=TableC=
fldX
fldY
fldZ

The number of records in TableA and TableB are not the same, but there is a
1-to-1 correlation, top-down, between the tables, and I only need the first
n records of TableB, where n is the number of records in TableA. I'm not
sure if I need a union query, or some kind of join.

I tried this:

SELECT "fldY", "fldZ", fldX
FROM TableA
UNION SELECT fldY, fldZ, "fldX"
FROM TableB

close, but no cigar...
Nov 13 '05 #1
1 1432
Oh, that's not a union query, that's a join.
Given: A(p,x), B(y,z)
Goal: C(x,y,z)

select A.x, B.y, B.z
from A inner join B on A.x=B.y

will give you all values of X,Y,Z where values {x,y} match in A and B.

UNION will give you a single column where they may not match.

If this doesn't solve your problem, give a really small sample of your
data - enough to describe the situation. e.g.

A.x contains {1,3,5}
B.z contains {1,2,3,4,5}

HTH

Nov 13 '05 #2

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

Similar topics

1
1634
by: Dalan | last post by:
Trying to determine the best approach to use in consolating multiple records in an Access 97 Db. The users submit updates in HTML format generated from a query that are in turn imported into a master database. There are 50+/- records each that are submitted by a substantial number of users with each periodic update. The output does include the user ID reference and the date prepared, but as a query has no header, the information is...
0
1929
by: Dalan | last post by:
I'm not certain if this is doable in the manner explained below, but I'm certain that there have been Access developers who have done something similar. So whatever insight and assistance that can be provided will be much appreciated. There is a separate Update Query (well several) that consolidate various goods from separate tables for access and selection on a sales/order invoice form. The data which is available is the TagNo,...
2
1437
by: braley | last post by:
I am using MS Access 2003 and am in the process of creating a database that contains contact information and attendance data for a group of volunteers. I have created a table that contains all of the fields for contact data and set the Full_Name as the primary index in that table. I have also set up a table which contains Yes/No fields for each month of the year in which to mark attendance. This table also includes the Full_Name field...
6
1837
by: Maital | last post by:
Dear experts, I'm a beginner with ms-access. I have data from 3 years of observations on a certain field, divided into North and South sections. The first table has information for about 600 species. The other tables indicate weather a plant was found on the field that year. I'd like to create a query that combines the data for the 3 years, and presents only the plants that grew in the field for at least one year.
9
20100
by: deko | last post by:
I need to create a Recordset of all records that appear in one table but do NOT appear in another. To get the records that appear in BOTH tables, I can do this: SELECT tblEntity.Entity_ID FROM tblEntity INNER JOIN tblDocuments ON tblEntity.Entity_ID = tblDocuments.Entity_ID;
3
2736
by: martin1 | last post by:
rHi, All I knew cross-tab quesy is easy done on the Access DB, is there easy way to do cross-tab query for SQL server DB in VB.NET 2005 Dev environment? Thanks
1
6460
by: jason.teen | last post by:
Hi, I have this scenario - 2 separate db's (filename = dbOne.mdb" and "dbTwo.mdb") both with a table called tblMapped in it dbOne.tblMapped looks like: ---------------------------------------------------------------------------------------- ID (autonumber) | Source_System | Description ---------------------------------------------------------------------------------------
2
1400
by: LLLiddle | last post by:
As an Access learner, I'm tearing my hair out over what is probably a simple problem. I hope someone can help. I have a table for Clients (tbl.Clients with pkClientID). Each client may use one, two or three services (tblFood, tblMoney, and tblMentoring). Each of these tables contains a field, fkClientID. Within each of the three service tables there is a date field indicating each occasion a client used the service. A client may...
1
1423
by: mukesh | last post by:
I have four tables as follows Table -1 – "expenditure" Field 1- date of payment Field 2 – type of payment Field 3 – Amount paid Table – 2 "Medicine purchase" Field 1- date of purchase Field 2 – Name of medicine
0
8428
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, 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...
0
8851
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, 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...
0
8754
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 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...
1
8542
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,...
1
6181
isladogs
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...
0
5650
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();...
1
2760
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
2
1984
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1740
bsmnconsultancy
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...

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.