473,320 Members | 2,112 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,320 software developers and data experts.

Help needed for crosstab query

I've been trying to construct a Crosstab query (mess pasted below) that
would output all rows, even if the Value (a count) is 0. No matter what I
do, it only returns rows that have matching records. Is it possible to do
this? I have a report based on the query that needs to show all of the
products and activities, even if the EventID is 0.

I'm grateful for any suggestions.
TRANSFORM Count(TrainingCenterSummary_qry.EventID) AS CountOfEventID
SELECT TrainingCenterSummary_qry.ProductName,
TrainingCenterSummary_qry.Activity, TrainingCenterSummary_qry.CourseNumber,
Count(TrainingCenterSummary_qry.EventID) AS [Total Of EventID]
FROM TrainingCenterSummary_qry
GROUP BY TrainingCenterSummary_qry.ProductName,
TrainingCenterSummary_qry.Activity, TrainingCenterSummary_qry.CourseNumber
PIVOT TrainingCenterSummary_qry.ClassroomCity;
Nov 12 '05 #1
3 3003
"Chuck Grimsby" <c.*******@worldnet.att.net.invalid> wrote in message
news:9c********************************@4ax.com...


Does the TrainingCenterSummary_qry show all the events?
Yes, all of the events appear in that query. What I need, is to have the
report include all possible row and column combinations, whether there is a
corresponding event or not. I've tried joining the table to itself and
every other combination I can think of, but can't get the crosstab to
include the rows that don't have matching records.
If not, you need to fix that, not the crosstab.

On Sat, 22 Nov 2003 09:34:18 GMT, "Randy Harris" <ra***@SpamFree.com>
wrote:
I've been trying to construct a Crosstab query (mess pasted below) that
would output all rows, even if the Value (a count) is 0. No matter what Ido, it only returns rows that have matching records. Is it possible to dothis? I have a report based on the query that needs to show all of the
products and activities, even if the EventID is 0.
I'm grateful for any suggestions.

TRANSFORM Count(TrainingCenterSummary_qry.EventID) AS CountOfEventID
SELECT TrainingCenterSummary_qry.ProductName,
TrainingCenterSummary_qry.Activity, TrainingCenterSummary_qry.CourseNumber,Count(TrainingCenterSummary_qry.EventID) AS [Total Of EventID]
FROM TrainingCenterSummary_qry
GROUP BY TrainingCenterSummary_qry.ProductName,
TrainingCenterSummary_qry.Activity, TrainingCenterSummary_qry.CourseNumberPIVOT TrainingCenterSummary_qry.ClassroomCity;

--
Party On Dudes!

Nov 12 '05 #2
Anyone know if there is a way to "trick" the crosstab into outputting all of
the rows, even if the count is 0?

"Randy Harris" <ra***@SpamFree.com> wrote in message
news:u4**********************@newssvr28.news.prodi gy.com...
I've been trying to construct a Crosstab query (mess pasted below) that
would output all rows, even if the Value (a count) is 0. No matter what I
do, it only returns rows that have matching records. Is it possible to do
this? I have a report based on the query that needs to show all of the
products and activities, even if the EventID is 0.

I'm grateful for any suggestions.
TRANSFORM Count(TrainingCenterSummary_qry.EventID) AS CountOfEventID
SELECT TrainingCenterSummary_qry.ProductName,
TrainingCenterSummary_qry.Activity, TrainingCenterSummary_qry.CourseNumber, Count(TrainingCenterSummary_qry.EventID) AS [Total Of EventID]
FROM TrainingCenterSummary_qry
GROUP BY TrainingCenterSummary_qry.ProductName,
TrainingCenterSummary_qry.Activity, TrainingCenterSummary_qry.CourseNumber
PIVOT TrainingCenterSummary_qry.ClassroomCity;

Nov 12 '05 #3
DFS
"Randy Harris" <ra***@SpamFree.com> wrote in message
news:U0**********************@newssvr28.news.prodi gy.com...
Anyone know if there is a way to "trick" the crosstab into outputting all of the rows, even if the count is 0?

Yes, there is a way.

Change the last line of the Crosstab (the PIVOT line) so it's like this:

PIVOT TableName.FieldName in ('Field1','Field2','Field3','Field4',...)



"Randy Harris" <ra***@SpamFree.com> wrote in message
news:u4**********************@newssvr28.news.prodi gy.com...
I've been trying to construct a Crosstab query (mess pasted below) that
would output all rows, even if the Value (a count) is 0. No matter what I do, it only returns rows that have matching records. Is it possible to do this? I have a report based on the query that needs to show all of the
products and activities, even if the EventID is 0.

I'm grateful for any suggestions.
TRANSFORM Count(TrainingCenterSummary_qry.EventID) AS CountOfEventID
SELECT TrainingCenterSummary_qry.ProductName,
TrainingCenterSummary_qry.Activity,

TrainingCenterSummary_qry.CourseNumber,
Count(TrainingCenterSummary_qry.EventID) AS [Total Of EventID]
FROM TrainingCenterSummary_qry
GROUP BY TrainingCenterSummary_qry.ProductName,
TrainingCenterSummary_qry.Activity, TrainingCenterSummary_qry.CourseNumber PIVOT TrainingCenterSummary_qry.ClassroomCity;


Nov 12 '05 #4

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

Similar topics

1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
15
by: Richard Hollenbeck | last post by:
I tried to ask this question before on the 14th of January but I never got a reply. I'm still struggling with the problem. I'll try to rephrase the question: I have a crosstab query with rows...
6
by: Gary | last post by:
I have an example table with fields and records as shown below: RECORD_ID DATE PRODUCT QUANTITY 1 4/1/05 widget1 50 2 4/2/05 widget1 48 3 ...
4
by: Judy | last post by:
I'm using Access 2003 and was wondering if it is possible to have a paramater selection within a crosstab query so that I wouldn't need to build a new table. I have a select query that I'm using...
7
by: newguy | last post by:
I am trying to get the totals of a table by client by type of income. This query will get what I am looking for with each unique combination as a row: SELECT Sales.Client, BillCode.Type,...
2
by: Steven Taylor | last post by:
Hope someone can help. Table structure: Name : tbl_Runs Fields are: Run_ID Run_Date Run_Distance (km) Run_Duration (secs)
8
by: Penny | last post by:
(Access 2003 Multiuser Split DB, Windows XP Pro) Hi All, I would really appreciate just some basic tips on how to make a Crosstab Form based on a Crosstab Query. The query always has the same...
4
by: ringer | last post by:
I need help with a crosstab query. I would like the column headings to be the last 6 months, the row headings to be billers, and the data in the middle to be both the date that a payment was made...
2
by: Jim Devenish | last post by:
I wish to create a crosstab query as the record source for a report. It needs to count data between selected dates which are entered by the user in a popup window. The following Select query...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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)...
0
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

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.