Link to home
Start Free TrialLog in
Avatar of ajith_29
ajith_29

asked on

Works fine with isql but powerbuilder datawindow gives error

This script works fine when i run it with isql and gives me result
but when i run this script on powerbuilder database painter or datawindow it give error

"Incorrect syntax near '2'.
Select ..................................

"
The select is

SELECT a.comments,  
cc_paid = ( SELECT sum(payment_amount)
                       FROM Invoice,   Payments
                      WHERE ( Invoice.vendor_no = Payments.vendor_no ) and  
                            ( Invoice.invoice_number = Payments.invoice_number ) and  
                            ( Invoice.order_number = Payments.order_number )  
                   GROUP BY Invoice.order_number, Payments.fund_key  
                     HAVING ( Invoice.order_number = Encumbered_Funds.order_number ) and
                            ( Payments.fund_key = a.fund_key))
    FROM Encumbered_Funds  a
   WHERE a.order_number = "111"
ORDER BY Encumbered_Funds.fund_key ASC  

The whole select statement is repeated in the eroor message.
Please do help me.I have see this problem when i use a nested query in my  slect statment.I cannot change the select statement for the datawindow.Only powerbuilder gives the problem
Avatar of kamel007
kamel007

It happens to with me sometimes ..Just try to leave space at the end of each line in the select statement.It might seem silly but it usually works.
Avatar of ajith_29

ASKER

I tried it did not work
You may have done this, but it is not in your sample:  put a semi-colon at the end

and ... begin each line with a space or tab (same as rejected answer, but insures there are whitespaces)

and finally as a last result ...  this absolutely will work

create a database view and select from the view in your datawindow
ASKER CERTIFIED SOLUTION
Avatar of jkotek
jkotek

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial