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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

minus figures

Status
Not open for further replies.

SQLScholar

Programmer
Aug 21, 2002
2,127
GB
Hey all,

I am quering access via ODBC and SQL. I have a figure which depending on another result could be positive or negitive.

So if colA> then ColB must be negative. Is there a function to do this??

If not can i add a negitive. Must be entirely in SQL.

Dan

----------------------------------------
There are 2 types of computer, the prototype and the obsolete!!
 
Hi

As long as the numbers are signed, you just need a simple formula in SQL (eg A + B + C As Answer) and you will get the correct arithmetic result no matter what the sign of A, B, C

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Something like this ?
theValue * Sgn(ColB - ColA)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top