I would like to use the if operator in the select statement, using an executeQuery command.
Something like:
def tmpRec = BankStatement.executeQuery("select SUM(IF(operation='CREDIT',cashAmount,-1*cashAmount)) from BankStatement group by portfolio,currency,code")
go
but the IF operator doesn’t work.
thank you
Although I do not know Groovy SQL, in most DBMS the CASE statement is used as a conditional statement. Perhaps the following will work: