Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Informix conversion on sum

Status
Not open for further replies.
Joined
Oct 17, 2006
Messages
227
Hi okay I'm stuck

I have a script and would like to convert it to TSQL

Informix
select name, qty, inout, qty * ( inout || "1")
from table

Result

robert 1 - -1
Paul 2 + 2


does anyone know the TSQL for this?? Could it be case?


 
what does ( inout || "1") mean in informix?

"NOTHING is more important in a database than integrity." ESquared
 
It must be power logic function??Case will do it but I was wondering if there is anything like this


Informix

select name, qty, inout, qty * ( inout || "1")
from table


to convert for case is

SELECT Name,
Qty,
Inout,
SUM(CASE WHEN Inout = '+'
THEN qty
ELSE (Qty * -1) END) AS TotalQty
FROM table


giving the reults as stated.





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top