473,799 Members | 2,746 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join two queries?

6 New Member
Ok, I have having a problem joing these two queries. Can anyone please help me out here. These are the results of my two queries:

These are the values in the A1 field of QueryA
  • COCKBURN 2
    GT KW 1
    GTN 1
    IPP GT1
    IPP GT2
    KALG F5
    KALG F6
    KWIN C6
    MUJA 1
    MUJA 2
    MUJA 3
    MUJA 4
    MUJA C5
    MUJA C6
    MUJA D7
    MUJA D8

These are the values in fields A1 and X1 in QueryB:
Expand|Select|Wrap|Line Numbers
  1. COCKBURN      86.83
  2. GT KW1          10.44
  3. GTN 1            16.13
  4. IPP GT1          62.84
  5. IPP GT2          62.56
  6. KALG F5          15.12
  7. KALG F6          20.83
  8. KWIN C6          37.78
  9. MUJA 1            23.44
  10. MUJA 3            8.69
  11. MUJA 4            23.44
  12. MUJA C5          84.56
  13. MUJA C6          89.01
  14. MUJA D7          86.22
  15. MUJA D8          84.65
  16.  
In QueryB, the entry MUJA 2 is missing. What I need is to take the X1 field from QueryB and join those values with the A1 field from QueryA as follows:

Expand|Select|Wrap|Line Numbers
  1. COCKBURN      86.83
  2. GT KW1          10.44
  3. GTN 1            16.13
  4. IPP GT1          62.84
  5. IPP GT2          62.56
  6. KALG F5          15.12
  7. KALG F6          20.83
  8. KWIN C6          37.78
  9. MUJA 1            23.44
  10. MUJA 3            8.69
  11. MUJA 2
  12. MUJA 4            23.44
  13. MUJA C5          84.56
  14. MUJA C6          89.01
  15. MUJA D7          86.22
  16. MUJA D8          84.65
  17.  
How can this be done. I need this in another query. I have tried the join statements, but I get errors every time. Thanks in advance.
May 3 '06 #1
11 8188
CaptainD
135 New Member
It would be easier and more helpful if you posted information about your tables and show us your select statments instead of just the information you're getting.
May 3 '06 #2
dtinsley
6 New Member
I am getting the values from two different locations. The A1 field in QueryA is the locations of customers from the customer file. The A1 field is the locations for customers that had a purchase on day 1. The X1 field is the purchase amount for that day. It is coming from another database.
May 3 '06 #3
dtinsley
6 New Member
This is one statement I have tried:

SELECT *
FROM QueryA
LEFT OUTER JOIN
QueryB
ON QueryA.A1 = QueryB.A1

but I get an error (field is to small to accept the value....)
May 3 '06 #4
wlc04
70 New Member
What program are you using?
May 3 '06 #5
dtinsley
6 New Member
Access 2003
May 3 '06 #6
wlc04
70 New Member
You should just be able to create a new query with those queries in it - join fields A1 and add the desired fields to the query (I personally use the grid rather than SQL, so I can see all fields). Another option is to add the tables themselves to the query join on the fields and then add the desired options from each table.
May 3 '06 #7
dtinsley
6 New Member
i am wanting it to do this on the fly because these values will change from day to day
May 3 '06 #8
CaptainD
135 New Member
Again, if you post some table structure and your select statments for the queries it would be easier for others to help. If you have two queries then you have access to the tables even if they are in other databases.

If we know the two table structures we might be able to create a query straight off the tables. Or, if we can see how the select statments are put together we can figure out why you are not getting the information you want.

i am wanting it to do this on the fly because these values will change from day to day
What do you mean the "values will change"? If you're talking about the data then running the query gets the updated data when you run it. Or do you mean you'll have to change the queries "on the fly"?
May 3 '06 #9
wlc04
70 New Member
You say the data will change daily - are you connecting directly to the tables where the data resides or are you exporting data from the other dbs and importing into yours? If you connect directly then once you get your queries created the way you like then you're set - the results are dynamic. If you're doing exports (I personally have to do this a lot!!) then you may want to set something up to run automatically everyday which will update the tables in your db.

If your A1 fields are not wanting to join you might make sure they are the same data type - this will cause you errors.
May 3 '06 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

0
3075
by: B. Fongo | last post by:
I learned MySQL last year without putting it into action; that is why I face trouble in formulating my queries. Were it a test, then you would have passed it, because your queries did help me solve my problem. I'll turn to MySQL doc after getting through this pressing project. Thanks a lot Roger! Babale -----Urspr=FCngliche Nachricht-----
1
3457
by: Paul Bramscher | last post by:
Here's one for pathological SQL programmers. I've got a table of things called elements. They're components, sort of like amino acids, which come together to form complex web pages -- as nodes in trees which form parent-child relationships, sort of like newsgroups. For example, the parent_id field points to another element. Indent_level is there for denormalization purposes, to avoid costly recursive issues in querying. The...
1
2270
by: Beachvolleyballer | last post by:
hi there anyone had an idea to join following 2 queries to 1???? ----- QUERY 1 --------------------------------------------- SELECT TMS_CaseF_2.Name AS TCDomain_0, TMS_CaseF_3.Name AS TCDomain_1, TMS.CaseF.Name AS TCFolder_2, TMS_CaseF_1.Name AS TCFolder_3,
2
3680
by: Greg Stark | last post by:
I find I often want to be able to do joins against views where the view are aggregates on a column that has an index. Ie, something like SELECT a.*, v.n FROM a JOIN (select a_id,count(*) as n group by a_id) as v USING (a_id) where there's an index on b.a_id. assume there are other tables being joined so I can't just move the aggregate to the outermost layer.
3
23101
by: Ian Boyd | last post by:
i know nothing about DB2, but i'm sure this must be possible. i'm trying to get a client to create a view (which it turns out is called a "Logical" in DB2). The query needs a LEFT OUTER JOIN, but he doesn't know how to do that, or even if he can, and i don't have to time to learn DB2 from scratch right now. The following SQL Query is a trimmed sample of the full View (i.e. Logical) definition - and i would create it on an SQL based...
2
3359
by: HS Hartkamp | last post by:
Hi all, I have a table with analysis-results for various months. An item can -for a particular month- have the result 'list1', 'list2' or 'list3' depending on the result of the analysis. Next, I want to get an insight in how the various items change over time. For that, I compare the results of one month with the results of another month. The form in which I want this is a cross-tab-query with one month as a row-header and another...
9
3212
by: Alan Lane | last post by:
Hello world: Background: Yesterday, January 21, Doug Steele was kind enough to help me out on a Left Join problem. I was trying to return all stores and their Gross Adds for December, 2004 (even though some of them had no Gross Adds for that month). My query would only show the non-zero GA stores. Doug stated "It's because of the Where clause. The stores which don't have any records for the period in question are being eliminated...
3
1522
by: mariohiga | last post by:
Hello I've a really big doubt :) I've this two alternatives SELECT * FROM T1 a INNER JOIN T1 b ON a.F1 = b.F1 AND a.F2 = 1 SELECT *
14
2498
by: cjakeman | last post by:
Hi, Solved a little mystery yesterday when I built a form that combined 2 tables with a 1:M relationship and relational integrity. All the correct data was visible on the form but, if I tried to edit any of the fields, the PC bleeped. Seems it was due to the query the form was based on. Again, editing any of the fields of the query caused the PC to bleep.
2
2251
by: frederikengelen | last post by:
Hello all, We are seeing strange behaviour for queries on a table we need to convert data from. We try to find out whether table A(B_CONV_ID) contains data that does not exists in table B(CONV_ID). We expect that there is data missing in table B, thus finding a positive number of records. There are two tables, A and B.
0
9687
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
9543
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,...
0
10488
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
10029
tracyyun
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...
1
7567
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
5588
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4144
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
3761
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
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.