PDA

Click to See Complete Forum and Search --> : SQL-COMPUTE


SAMS
Oct 4th, 1999, 04:53 PM
Hi all, Have this small question about COMPUTE. As per below is the code that i used but it appears a syntax error(missing operator).

The code: ( EXPORT_ACC is my table)

Adodc1.recodsource = "Select VENDOR, GP, PEE From EXPORT_ACC WHERE VENDOR = 'NEWCASTL' COMPUTE(SUM(TOTALBILL)) BY Dept"

Adodc1.Refresh
.
.
.

I had double check all my fields, but the error this appears.

Pls give me some advices . Thks. If you got better command pls show me . Thks again.

JHausmann
Oct 5th, 1999, 01:06 AM
You'll need an "order by" if you want to "compute BY", as in:

Adodc1.recodsource = "Select VENDOR, GP, PEE From EXPORT_ACC WHERE VENDOR = 'NEWCASTL' order by Dept COMPUTE(SUM(TOTALBILL)) BY Dept"

SAMS
Oct 5th, 1999, 10:10 AM
Thks. I actually added the "order by dept" but the system still give me the syntax error in query expression "Dept COMPUTE(SUM(TOTALBILL)) BY Dept""

Furthermore I had checked all my fields are correct.Is there a miss out somewhere??
Hope someone can help.
Thks.

JHausmann
Oct 7th, 1999, 12:07 AM
I hate to ask the obvious question but is your query all on one line?

Aaron Young
Oct 7th, 1999, 12:20 AM
The problem is there are no Parenthesis "()" in the COMPUTE Statement, try this:

Adodc1.Recordsource = "SELECT VENDOR,GP,PEE FROM EXPORT_ACC WHERE VENDOR='NEWCASTL' ORDER BY Dept COMPUTE SUM(TOTALBILL) BY Dept"

------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net

SAMS
Oct 7th, 1999, 01:52 PM
Thks guys, but the methods doesn't seen to work. Yes, the command is all in one line.
does anyone have any other ways??

Pls help. Thks a lot.

Aaron Young
Oct 8th, 1999, 01:29 AM
Are you still getting the Error? Or can't you find your SubTotals? If you can't fnd your Subtotals, they are returned in a seperate Resultset.

------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net

SAMS
Oct 10th, 1999, 08:18 AM
Yes, I'm still getting the same error message. Any other ways to detect the problem?