If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > The boss wants me to do this...

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-21-04, 10:08
HomersDonut HomersDonut is offline
Registered User
 
Join Date: Nov 2002
Posts: 37
Question The boss wants me to do this...

This is a crosstab query in Access, hopefully this is the right section of the forums to place this....

I am getting the right results as far as what the boss wants to see, but
he just asked to see all the Equipment Names for the row headers, not just the ones that have results for the time period which is what I have now.

That way he can see which equipment isnt having any operations, as well as the equipment that is.
Any thoughts how to accomplish this?


PARAMETERS [Start Date] DateTime, [End Date] DateTime;
TRANSFORM Count([Operation Entry].[Operation Status ID No]) AS [CountOfOperation Status ID No1]
SELECT [Equipment Type].[Equipment Name]
FROM ([Operation Entry] INNER JOIN [Operation/Failure] ON [Operation Entry].[Operation Status ID No] = [Operation/Failure].[Operation Status ID No]) INNER JOIN [Equipment Type] ON [Operation Entry].[Equipment ID No] = [Equipment Type].[Equipment ID No]
WHERE ((([Operation Entry].[Operation Status ID No])=1 Or ([Operation Entry].[Operation Status ID No])=2) AND (([Operation Entry].[Class ID No])="4") AND (([Operation Entry].RecDate) Between [Start Date] And [End Date]))
GROUP BY [Equipment Type].[Equipment Name]
ORDER BY "# " & [Operation Status Name] DESC
PIVOT "# " & [Operation Status Name];
Reply With Quote
  #2 (permalink)  
Old 04-21-04, 13:52
HomersDonut HomersDonut is offline
Registered User
 
Join Date: Nov 2002
Posts: 37
I ended up making a query of the crosstab query and included the equipment table. Right join on the equiptable from the crosstab query.
It gave me two rows of equipment, but one of them was correct because it showed all equipment values.
So when I made the report I just didnt include the crosstab field from the original query.
It's a hack way of doing it but it works ...
Reply With Quote
  #3 (permalink)  
Old 04-21-04, 14:24
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
Isn't the universe actually a collection of hacks, bound together with kludges?

-PatP
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On