Hello world:
I have 2 tables. Table 1 has Store Information (tblStoreInfo) and contains
123 records. Primary key is STORE4_ID. Table 2 has Gross Addition
Information (tblDTTD_GA), by date and by store. It contains thousands of
records. Foreign key is STORE4_ID. They are related one-to many on
STORE4_ID.
I want to do a query which will give me the Gross Additions for all 123
stores for December 2004, whether or not they had any Gross Additions.
(Actually, only 114 stores had GA activity in December).
I have tried many different things, but I can't get Access to give me more
than 114 records for December. What am I doing wrong? Code is below.
Thanks for any help on this question!
Alan
SELECT
NZ(tblDTTD_GA.PERIOD,0) AS Period,
NZ(tblDTTD_GA.STORE4_ID,0) AS [Store4 ID],
NZ(tblStoreInfo.STORE_NAME,'unknown') AS [Store Name],
NZ(tblStoreInfo.STORE_TYPE,'unknown') AS [Store Type],
NZ(tblDTTD_GA.DTTD_ALLOC_GA,0) AS [Gross Addition]
FROM
tblStoreInfo
LEFT JOIN tblDTTD_GA
ON tblStoreInfo.STORE4_ID = tblDTTD_GA.STORE4_ID
WHERE
(((tblDTTD_GA.PERIOD)='200412'))
ORDER BY
tblDTTD_GA.STORE4_ID; 2 1876
It's because of the Where clause. The stores which don't have any records
for the period in question are being eliminated because you're not setting
their Period.
Try changing it to
WHERE
(((Nz(tblDTTD_GA.PERIOD), '200412') = '200412'))
--
Doug Steele, Microsoft Access MVP http://I.Am/DougSteele
(no e-mails, please!)
"Alan Lane" <al****@san.rr.com> wrote in message
news:Nu*******************@twister.socal.rr.com... Hello world:
I have 2 tables. Table 1 has Store Information (tblStoreInfo) and contains 123 records. Primary key is STORE4_ID. Table 2 has Gross Addition Information (tblDTTD_GA), by date and by store. It contains thousands of records. Foreign key is STORE4_ID. They are related one-to many on STORE4_ID.
I want to do a query which will give me the Gross Additions for all 123 stores for December 2004, whether or not they had any Gross Additions. (Actually, only 114 stores had GA activity in December).
I have tried many different things, but I can't get Access to give me more than 114 records for December. What am I doing wrong? Code is below. Thanks for any help on this question!
Alan
SELECT NZ(tblDTTD_GA.PERIOD,0) AS Period, NZ(tblDTTD_GA.STORE4_ID,0) AS [Store4 ID], NZ(tblStoreInfo.STORE_NAME,'unknown') AS [Store Name], NZ(tblStoreInfo.STORE_TYPE,'unknown') AS [Store Type], NZ(tblDTTD_GA.DTTD_ALLOC_GA,0) AS [Gross Addition]
FROM tblStoreInfo LEFT JOIN tblDTTD_GA ON tblStoreInfo.STORE4_ID = tblDTTD_GA.STORE4_ID
WHERE (((tblDTTD_GA.PERIOD)='200412'))
ORDER BY tblDTTD_GA.STORE4_ID;
Hi Doug:
That worked like a charm! Many thanks!
Alan
"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:-f********************@rogers.com... It's because of the Where clause. The stores which don't have any records for the period in question are being eliminated because you're not setting their Period.
Try changing it to
WHERE (((Nz(tblDTTD_GA.PERIOD), '200412') = '200412'))
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Alan Lane" <al****@san.rr.com> wrote in message news:Nu*******************@twister.socal.rr.com... Hello world:
I have 2 tables. Table 1 has Store Information (tblStoreInfo) and contains 123 records. Primary key is STORE4_ID. Table 2 has Gross Addition Information (tblDTTD_GA), by date and by store. It contains thousands of records. Foreign key is STORE4_ID. They are related one-to many on STORE4_ID.
I want to do a query which will give me the Gross Additions for all 123 stores for December 2004, whether or not they had any Gross Additions. (Actually, only 114 stores had GA activity in December).
I have tried many different things, but I can't get Access to give me more than 114 records for December. What am I doing wrong? Code is below. Thanks for any help on this question!
Alan
SELECT NZ(tblDTTD_GA.PERIOD,0) AS Period, NZ(tblDTTD_GA.STORE4_ID,0) AS [Store4 ID], NZ(tblStoreInfo.STORE_NAME,'unknown') AS [Store Name], NZ(tblStoreInfo.STORE_TYPE,'unknown') AS [Store Type], NZ(tblDTTD_GA.DTTD_ALLOC_GA,0) AS [Gross Addition]
FROM tblStoreInfo LEFT JOIN tblDTTD_GA ON tblStoreInfo.STORE4_ID = tblDTTD_GA.STORE4_ID
WHERE (((tblDTTD_GA.PERIOD)='200412'))
ORDER BY tblDTTD_GA.STORE4_ID;
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jon Ole Hedne |
last post by:
My Access 2002-application need to work with tables from both Oracle and
Access. To solve this, I want to run some querys on three views in Oracle
and import the results into temporary...
|
by: deko |
last post by:
From what I understand, an Inner Join narrow the rows selected to the table
with the least results... and an Outer Join does the opposite...
SELECT qryTxToQ1.Q1Total, qryTxToQ2.Q2Total,...
|
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...
|
by: jphelan |
last post by:
I have a subform that works fine until you import it into a new
database when it crashes if you try to open it in either disign or form
view.
The form, "Attendees_Subform" in my application was...
|
by: ms |
last post by:
I successfully ran queries with functions in Access 2000 that no longer run in
2003. Also, when I convert it back to 2000 and run from 2000, I continue to get
a compile error.
The compile error...
|
by: media.opslag |
last post by:
Hi,
How can i get this to work in access / jet sql ??? Someone??
SELECT
tbl1.,
tbl2.
FROM tbl1
left outer join tbl2 on
|
by: alexandre.brisebois |
last post by:
Hi, I am using access 2003, I would like to know if there is an option
to reorganize the tables in a maner that is readable, as we can do in
sql sever 2000 or 2005.
I have been given a database...
|
by: David F |
last post by:
Hello,
I have what seems like a simple left join query,
but Access returns results like it's an inner join. I've tried
numerous combinations without success.
I have a table (ProjectList)...
|
by: popo725 |
last post by:
Hi,
I'm new at using Microsoft Access (2003), and I've created a "MonthlyReport" query, which has functioned properly in the past and I update the table monthly as I update the data in the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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,...
|
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,...
| |