zhangguowu0506
27th September 2008, 06:56
I use the menu of "Query By Easy SQL..." to create a simply SQL,it generate the SQL "SELECT tfacp200.ninv,tfacp200.ttyp,sum(tfacp200.amnt) from tfacp200 group by tfacp200.ninv,tfacp200.ttyp",it can be run normal,but I replace tfacp200.amnt with tfacp200.amth(1),and it generate the SQL "SELECT tfacp200.ninv,tfacp200.ttyp,sum(tfacp200.amth(1)) from tfacp200 group by tfacp200.ninv,tfacp200.ttyp ", it can't be run normal,it show "SQL not correct", but the two fields are double,only the seconds field name contain with parentheses?if I want to sum this filed which name contain with parentheses,what shall I do?who can help me,my email address is:zhangguowu0506@hotmail.com

NPRao
7th October 2008, 03:40
I tested your SQL with qptool on our LN Tools system and it did not work -
SELECT tfacp200.ninv,tfacp200.ttyp, sum(tfacp200.amnt):total.amnt from tfacp200 group by tfacp200.ninv,tfacp200.ttyp

I got the error -

[0] SQLState HYL06: select item 3 must be bound explicitly (302)

so I changed it to the following statements and it worked -

SELECT tfacp200.ninv,tfacp200.ttyp, sum(tfacp200.amnt):total.amnt from tfacp200 group by tfacp200.ninv,tfacp200.ttyp

SELECT tfacp200.ninv,tfacp200.ttyp, sum(tfacp200.amth(1)):total.amnt from tfacp200 group by tfacp200.ninv,tfacp200.ttyp