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

Combine Query Problem

Hi Every1

Having a slight issue on creating a query to combine 2 queries, this year and last years data.

The thing is, I have data for this year for all stores, however on last year I dont for every record.

On the "combined" query, it only returns records with both this year and last year data. It "drops" any records without last years data.

Is there any way I can make the query return " " rather than null so all records are pulled through??

Many Thanks


Dan
Sep 1 '07 #1
3 1254
JConsulting
603 Expert 512MB
Hi Every1

Having a slight issue on creating a query to combine 2 queries, this year and last years data.

The thing is, I have data for this year for all stores, however on last year I dont for every record.

On the "combined" query, it only returns records with both this year and last year data. It "drops" any records without last years data.

Is there any way I can make the query return " " rather than null so all records are pulled through??

Many Thanks


Dan
Hi Dan,
Generally this is done as a union query. If your field count matches in both tables, you can do something like so

Expand|Select|Wrap|Line Numbers
  1. Select * from table1
  2. Union All
  3. Select * from table2;
  4.  
This should stack your results from both tables into one recordset vs trying to join them
Let us know if this is or is not the way you wish to go...and we'll provide more assistance.
J
Sep 1 '07 #2
Hi There

I have just tried the union query you suggested. Unfortunately this puts the data from the last year query into a different row.

I would like to have the data for this year and last in the same row, that way I can analyse the % change etc.

Is this possible?

Many Thanks


Dan
Sep 1 '07 #3
Its ok, I have managed to resolve this!

I have now created a relationship on store number in the query itself, showing all field for this year, and only those where last year are equal.


Thanks for your help



Dan
Sep 1 '07 #4

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

Similar topics

1
by: snOOp | last post by:
I am trying to combine the data from two similar tables into one query, but I need for all of the records from both tables to show up and I want the ones that have matching 'emplid' to be combined...
5
by: Jamie Pittman via AccessMonster.com | last post by:
I have two tables with 5000 entries on them. One is based for regular time with several variables example (employee name, date,time in and out, code, customer, building) I have another table that...
1
by: mojo | last post by:
We have set up an Access database with tables x,y, & z where we would like to have multiple people entering data into a table x. Each person has an identical copy of the database on their PC's. ...
0
by: MostlyH2O | last post by:
Hi Folks, I have a complex query that references a sub-query. It works fine when I call a sub-query from the main query (using design vew), but when I try to embed the SQL text of the...
5
by: jhutchings | last post by:
Hello everyone, I have a database where I collect shipment data from various tables. However, I have a problem. Whenever I want to see shipping data for orders that were set to ship on or before...
1
by: bluereign | last post by:
Thank you for your assistance. I am a novice looking to JOIN and append or combine records from 2 current Tables into 2 new Tables named below. I have been able to JOIN Tables with the script...
1
by: csolomon | last post by:
Hello: I am using two queries to get one result set. The issue is, I return no data when I combine them into one query. I have listed both queries, as well as the 3rd query that shows them...
2
by: bips2005 | last post by:
i have got two queries, $sql1 = "select cust_id from customer where comp_name = '$compname'"; $result = $DB->query($sql1); $result->fetchInto($row); $sql = "select expirydate from...
1
by: LSGKelly | last post by:
Hi all. I need to combine two fields that contain numbers that are in a currency format (Ex: $1,500 $3,500). When I combine them, I want them to look like this -- $1,500/$3,500. When I combine...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
agi2029
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,...
0
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...

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.