Jump to content
Stef's Coding Community
Sign in to follow this  
Moloney

Numeric Function Issue Mysql

Recommended Posts

Hi,

 

 

I am just wondering why CEILING(10*RAND()) is giving more than one value sometimes and no values at other times when it is combined with the WHERE clause.

 

 

On the other hand, if it is just used with SELECT CEILING(10*RAND()); it consistently yields only one value between one and ten.

 

 

I've copied an image below with some MySQL executions to better illustrate what I mean.

 

 

Any ideas why this is? [please tell me if this question is not clear]

 

Why do I have to limit the query to 1 --> should it not be only one value returned anyways?

 

Edited by Stephenius

Share this post


Link to post
Share on other sites

Sorry, I'm not sure what's going on with that -- I would expect "ceiling(10*rand())" to only ever return one value.

 

This sort of question might be better off asked at StackOverflow, where you'll have more people with more insight into MySQL's quirks.

Share this post


Link to post
Share on other sites

okay. thanks for trying. I might join stackoverflow and see.

Anyways, I'd say I'll look into it again, post it there & post back here sometime in the future if I get some sort of answer.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...