on 12-04-2007 11:24 AM
Hi Everybody,
Question: Is it possible to have total of a specific column when I create a query?
In my example I created a query for all the costs related to a project (tables OPOR and POR1). I have the column of the price of every lineitem (Price from table POR1). Query works but I would need to have the total of the prices, possibly in the field called QI Direct Access Mtx1 (the one in the grid of the results). Is it possible?
Thanks in advance
Federico,
In SQL you have a function called Rollup which can be used to show totals.
Please refer to SQL Server help files for syntax
Suda
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Federico,
That option is not available as default. It has to be User initiated.
Suda
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Suda,
Thanks for your answer;
what do you mean with "not available as default"?
Do you mean that there isn't a specific check in a menu (but maybe I can enable it, query by query, with a script or something) or that is impossible to create a query with totals automatically shown?
Sorry if I bother you but, believe me, it's more difficult to explain to users to click CTRL + Left button than create every query with totals shown...
Thanks in advance and sorry again
You can make totals in sql by using the group by close, but it may be inconvenient with detailed lists. You can also use something like this :
SELECT top 100
T0.ItemCode, T0.OnHand, T0.IsCommited, T0.AvgPrice, T0.Locked
FROM OITW T0
Union all
Select null,
(select sum(w.onhand) from
(
SELECT top 100
T0.ItemCode, T0.OnHand, T0.IsCommited, T0.AvgPrice, T0.Locked
FROM OITW T0
) w)
,null,null,null
Hi
Don't know whether it's available by default. I found it by accident one day.
Regards
Daan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Federico
You can view the total of a column in the query result by holding the CTRL key and clicking on the label of the column.
Regards
Daan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.