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

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 1414
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
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...
0
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...
2
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...
6
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...
9
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...
3
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
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:...
2
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...
1
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-...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...

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.