We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

SQL Query Problem

bejhan
bejhan asked
on
Medium Priority
274 Views
Last Modified: 2012-05-07
I have written the below query to select items from tblItems which have different balances than their counter parts in stblBalances. However, as you can see in the picture it is pulling up records with balances that should match. In both tables the balance fields are the same (Type: Double, Format: Fixed, Decimal Places: 3).

Why is this not pulling up the correct results?
SELECT a.ItemID, a.Balance, b.Balance, a.RequiresReview, a.Category, a.Completed
FROM tblItems AS a, stblBalances AS b
WHERE a.ItemID = b.ItemID AND a.Balance <> b.Balance

Open in new window

balances.bmp
Comment
Watch Question

Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
Ah shoot I should have known, I was having a similar problem with conditional formatting. I just figured SQL would be able handle that problem. Thanks!
Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
rounding, I presume.
the display is rounded, but the values do indeed not match

round(a.Balance) <> round(b.Balance)

Open in new window

Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
too slow :(
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.