Results 1 to 8 of 8

Thread: SQL-COMPUTE

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    Singapore
    Posts
    43

    Post

    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.

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    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"

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    Singapore
    Posts
    43

    Post

    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.


  4. #4
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    I hate to ask the obvious question but is your query all on one line?

  5. #5
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    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
    [email protected]
    [email protected]

  6. #6

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    Singapore
    Posts
    43

    Post

    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.

  7. #7
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    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
    [email protected]
    [email protected]

  8. #8

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    Singapore
    Posts
    43

    Post

    Yes, I'm still getting the same error message. Any other ways to detect the problem?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width