Jump to content

Recommended Posts

I have a table with a column type 'decimal'. The table is called 'uc_product', and the column is 'sell_price'. There are two rows:

 

row 1: sell_price = 25.00000

row 2: sell_price = 22.55000

 

The following query is returning both rows, though I am of the belief that it should only be returning the first row:

 

SELECT n.nid FROM node AS n JOIN uc_products AS up WHERE n.type = "product" AND up.sell_price >= 25 AND up.sell_price <= 30

 

I've not worked with columns type decimal before, so this one is throwing me for a loop. I've tried passing in values of 25.00 and 30.00, but I still get back the same two rows. Does anybody have any idea on where I'm going wrong here?

Link to comment
https://forums.phpfreaks.com/topic/194723-comparing-with-column-type-decimal/
Share on other sites

So now I've tried this query:

 

SELECT n.nid, up.sell_price

FROM node AS n

JOIN uc_products AS up

WHERE n.type = "product"

AND up.sell_price =25

 

And it returns two rows:

row  nid  sell_price

1    19  25.00000

2    20  25.00000

 

I have no idea why it is returning a value of 25.0000 for the sell price where nid is 20 - the value in the column is 22.55000.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.