A Microsoft Office (Excel, Word) forum. OfficeFrustration

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   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Crosstab query totals



 
 
Thread Tools Display Modes
  #1  
Old April 27th, 2010, 06:36 PM posted to microsoft.public.access
jbair via AccessMonster.com
external usenet poster
 
Posts: 25
Default Crosstab query totals

Need some help,
I have a crosstab query that returns the following data see sql below, what I
need is to total all gearbox types that are R and 37 and R and 27 and R and
47 etc. an example R and RF 27 total = 492

1 2 4 SubTotals
R 27 20 26 303 12 361
R 37 6 66 307 8 387
R 47 8 87 424 2 521
R47R 37 2 2
R57R 37 3 2 5
R67R 37 1 1 2
R77R 37 19 19
RF 27 4 17 109 1 131
RF 37 1 11 76 88
RF 47 1 25 39 65
TRANSFORM Sum(InspectionLog.Quantity) AS SumOfQuantity
SELECT Sum(InspectionLog.Quantity) AS SubTotals, InspectionLog.GearboxType
FROM InspectionLog
WHERE (((InspectionLog.GearboxType) Like "r* 27*")) OR (((InspectionLog.
GearboxType) Like "r* 37*")) OR (((InspectionLog.GearboxType) Like "r* 47*"))
GROUP BY InspectionLog.GearboxType
PIVOT InspectionLog.AssyLineNumberInspection;

Thanks,
Jerry

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/201004/1

  #2  
Old April 27th, 2010, 07:31 PM posted to microsoft.public.access
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Crosstab query totals

Try this --
TRANSFORM Sum(InspectionLog.Quantity) AS SumOfQuantity
SELECT Sum(InspectionLog.Quantity) AS SubTotals,
IIF(InspectionLog.GearboxType Like "R? ?7", "R or RF",
InspectionLog.GearboxType) AS Gearbox
FROM InspectionLog
WHERE (((InspectionLog.GearboxType) Like "r* 27*")) OR
(((InspectionLog.GearboxType) Like "r* 37*")) OR
(((InspectionLog.GearboxType) Like "r* 47*"))
GROUP BY InspectionLog.GearboxType
PIVOT InspectionLog.AssyLineNumberInspection;


--
Build a little, test a little.


"jbair via AccessMonster.com" wrote:

Need some help,
I have a crosstab query that returns the following data see sql below, what I
need is to total all gearbox types that are R and 37 and R and 27 and R and
47 etc. an example R and RF 27 total = 492

1 2 4 SubTotals
R 27 20 26 303 12 361
R 37 6 66 307 8 387
R 47 8 87 424 2 521
R47R 37 2 2
R57R 37 3 2 5
R67R 37 1 1 2
R77R 37 19 19
RF 27 4 17 109 1 131
RF 37 1 11 76 88
RF 47 1 25 39 65
TRANSFORM Sum(InspectionLog.Quantity) AS SumOfQuantity
SELECT Sum(InspectionLog.Quantity) AS SubTotals, InspectionLog.GearboxType
FROM InspectionLog
WHERE (((InspectionLog.GearboxType) Like "r* 27*")) OR (((InspectionLog.
GearboxType) Like "r* 37*")) OR (((InspectionLog.GearboxType) Like "r* 47*"))
GROUP BY InspectionLog.GearboxType
PIVOT InspectionLog.AssyLineNumberInspection;

Thanks,
Jerry

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/201004/1

.

  #3  
Old April 27th, 2010, 07:51 PM posted to microsoft.public.access
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Crosstab query totals

Jbair -

This answer assumes you are only looking at the final two characters for the
27, 37, ot 47. Not sure where you would put the 'R47R 37' record - I assumed
it would be grouped with 'R 37'. Try this out (untested) and let us know:

TRANSFORM Sum(InspectionLog.Quantity) AS SumOfQuantity
SELECT Sum(InspectionLog.Quantity) AS SubTotals, "R " &
Right(InspectionLog.GearboxType,2) AS GearBoxTypeGroup
FROM InspectionLog
WHERE (((InspectionLog.GearboxType) Like "r*")
AND ((Right(InspectionLog.GearboxType,2) In ("27","37","47")))
GROUP BY ("R " & Right(InspectionLog.GearboxType,2))
PIVOT InspectionLog.AssyLineNumberInspection;

--
Daryl S


"jbair via AccessMonster.com" wrote:

Need some help,
I have a crosstab query that returns the following data see sql below, what I
need is to total all gearbox types that are R and 37 and R and 27 and R and
47 etc. an example R and RF 27 total = 492

1 2 4 SubTotals
R 27 20 26 303 12 361
R 37 6 66 307 8 387
R 47 8 87 424 2 521
R47R 37 2 2
R57R 37 3 2 5
R67R 37 1 1 2
R77R 37 19 19
RF 27 4 17 109 1 131
RF 37 1 11 76 88
RF 47 1 25 39 65
TRANSFORM Sum(InspectionLog.Quantity) AS SumOfQuantity
SELECT Sum(InspectionLog.Quantity) AS SubTotals, InspectionLog.GearboxType
FROM InspectionLog
WHERE (((InspectionLog.GearboxType) Like "r* 27*")) OR (((InspectionLog.
GearboxType) Like "r* 37*")) OR (((InspectionLog.GearboxType) Like "r* 47*"))
GROUP BY InspectionLog.GearboxType
PIVOT InspectionLog.AssyLineNumberInspection;

Thanks,
Jerry

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/201004/1

.

  #4  
Old April 28th, 2010, 06:57 PM posted to microsoft.public.access
jbair via AccessMonster.com
external usenet poster
 
Posts: 25
Default Crosstab query totals

Thanks Daryl that worked great!

Daryl S wrote:
Jbair -

This answer assumes you are only looking at the final two characters for the
27, 37, ot 47. Not sure where you would put the 'R47R 37' record - I assumed
it would be grouped with 'R 37'. Try this out (untested) and let us know:

TRANSFORM Sum(InspectionLog.Quantity) AS SumOfQuantity
SELECT Sum(InspectionLog.Quantity) AS SubTotals, "R " &
Right(InspectionLog.GearboxType,2) AS GearBoxTypeGroup
FROM InspectionLog
WHERE (((InspectionLog.GearboxType) Like "r*")
AND ((Right(InspectionLog.GearboxType,2) In ("27","37","47")))
GROUP BY ("R " & Right(InspectionLog.GearboxType,2))
PIVOT InspectionLog.AssyLineNumberInspection;

Need some help,
I have a crosstab query that returns the following data see sql below, what I

[quoted text clipped - 22 lines]
Thanks,
Jerry


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/201004/1

 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:47 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.