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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Expr1002
I have a query something like this. I want to order it by total. Everything else works OK
only ordering doesn't work. It displays me window - 'Enter Parameter Value'. If I enter something, it displays it again, and so four times. And it DOESN'T order by total anyway. I have tried without 'as total' clause and tried to 'order by Expr1002' but nothing works. What's the point? Please advice. select title, element, SUM(proce) as total FROM (SELECT blaah, blaah Union SELECT blaah, blaah Union SELECT blaah, blaah Union SELECT blaah, blaah ) GROUP BY element, title order by total |
#2
|
|||
|
|||
aak wrote:
I have a query something like this. I want to order it by total. Everything else works OK only ordering doesn't work. It displays me window - 'Enter Parameter Value'. If I enter something, it displays it again, and so four times. And it DOESN'T order by total anyway. I have tried without 'as total' clause and tried to 'order by Expr1002' but nothing works. What's the point? Please advice. select title, element, SUM(proce) as total FROM (SELECT blaah, blaah Union SELECT blaah, blaah Union SELECT blaah, blaah Union SELECT blaah, blaah ) GROUP BY element, title order by total Don't ask me why, but you can not use an alias name in the Order By clause. The straightforward way is to repeat the expression: ORDER BY SUM(proce) That can get to be messy with longer expressions so you may want to use an alternat syntax where you can specify the number of the field. E.g: ORDER BY 3 -- Marsh MVP [MS Access] |
Thread Tools | |
Display Modes | |
|
|