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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sort Table On An expression 1

Status
Not open for further replies.

Silvinho

Programmer
Jul 9, 2001
58
GB
Is it possible to sort a table on an Expression Sum.
i.e: [SumOfLeague_Goals]+[SumOfCup_Goals]As Expr1

Then ORDER BY Expr;

Whenever i try this it fails.
 
Hi!

I have not had any trouble sorting on expressions, though I usually sort on a count and not a sum I wouldn't think that would make any difference. I noticed that your order by in the example referenced Expr instead of Expr1. I assume that is a typo and not the cause of your problem. Maybe you could post the SQL code that is causing problems?

hth
Jeff Bridgham
 

It appears that Access cannot resolve the aliases and treats them as parameters. I've not been able to make that particular query construct work. I suggest the following change.

Rewrite the expression as Expr1: [League_Goals]+[Cup_Goals] and select Sum in the Total row of the query designer so that Order By clause looks like the following.

ORDER BY Sum([League_Goals]+[Cup_Goals]);
Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums. NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top