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!

Comparing Numbers – Number Difference 2

Status
Not open for further replies.

Accel45

Technical User
Jul 7, 2004
83
US
I am attempting to create a query that shows the number of digits between two numbers.
The problem I am having is with negative numbers and sorting.

This what I am getting (Sort on Difference)
BaseNumber - OtherNumber = Difference
75 76 -1
75 75 0
75 74 1
75 70 5

This is what I want to get (Sort on Difference)
BaseNumber - OtherNumber = Difference
75 75 0
75 76 1
75 74 1
75 70 5

Looking for Suggestions on how to accomplish this.

Accel45
 
Hi,
Try the ABS (absolute) function

Skip,

[glasses] [red]Be advised:[/red] The dyslexic, agnostic, insomniac, lays awake all night wondering...
"Is there really a DOG?" [tongue]
 
ABS function

[tt]differense: abs(BaseNumber - OtherNumber)[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top