coyote999
Posts: 22
|
Posted: 02/08/2004, 6:32 PM |
|
Hi all!
I have a little problem with the "compute sum" syntax.
SELECT X1, X2, X3
FROM table
ORDER BY X1
COMPUTE SUM(X1), BY X2
In the query, i only get the values of the table
But i want the sum of the values of X1
Can anyone help?
Greetings
Martin
|
|
|
peterr
Posts: 5971
|
Posted: 02/08/2004, 10:57 PM |
|
This may be difficult to answer without knowing which database (and version) you're using.
Many databases won't allow such syntax and you would rather do:
SELECT Sum(X1), X2, X3
FROM table
GROUP BY X2, X3
ORDER BY Sum(X1)
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
coyote999
Posts: 22
|
Posted: 02/09/2004, 3:02 AM |
|
Hi!
I use MS-SQL.
|
|
|
peterr
Posts: 5971
|
Posted: 02/09/2004, 3:15 PM |
|
Well, I also asked about the version (of the database), while it would be good know even more about your environment, including the programming language and the database driver you're using.
Generally I can only say that the COMPUTE statement is not fully supported by Microsoft, not supported by all drivers, possibly even being phased out. See: http://groups.google.com/groups?th=903fdf9123cef201&see...1.phx.gbl#link5
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
|
|
|