Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error in SQL for Query of Crosstab 1

Status
Not open for further replies.

cbpwc01

Technical User
Feb 11, 2005
25
0
0
UM
I've been working on this for about an hour and have a mistake in the code--the error I keep receiving is that it does not recognize the field name TypeCrasstab as a valid field name or expression. The calculation commands are to display percentages for each field calculated from a crosstab query in place.

The crosstab query has the column headings: Type, TotalofAllocation, Aurora, PMFI, PMFII and WCMRT.

The code I have thus far is as follows:

Code:
 SELECT [TypeCrosstab]
, TypeCorsstab.aurora
, CInt([aurora]/TotalofAllocation)*100,
TypeCrosstab.PMFI
, CInt([PMFI]/TotalofAllocation)*100,
TypeCrosstab.PMFII
, CInt([PMFII]/TotalofAllocation)*100,
TypeCrosstab.WCMRT
, CInt([WCMRT]/TotalofAllocation)*100
FROM [TypeCrosstab]

I'm sure I made a stupid mistake...can someone please point it out?

Thanks!
 
You wanted this ?
SELECT TypeCrosstab.Type
, TypeCrosstab.aurora
, CInt(100*[aurora]/TotalofAllocation) AS [% Aurora],
TypeCrosstab.PMFI
, CInt(100*[PMFI]/TotalofAllocation) AS [% PMFI],
TypeCrosstab.PMFII
, CInt(100*[PMFII]/TotalofAllocation) AS [% PMFII],
TypeCrosstab.WCMRT
, CInt(100*[WCMRT]/TotalofAllocation) AS [% WCMRT]
FROM [TypeCrosstab]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Beautiful!

My brain was fried so I was having difficulty writing this. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top