Jump to content

MySQL Query Help


azlan3522

Recommended Posts

I have an SQL query that inserts data into my database. I'm trying to use the mysql function STDDEV_SAMP(), and it doesn't appear to work. Here it is:

$query = "INSERT INTO table (percent, deviation) VALUES ($percent, STDDEV_SAMP(percent))";

I've searched around to see if anyone has used Aggregate functions in an INSERT INTO query, but I haven't found anything that has helped me yet. Note that this is sample code that I'm using to display my problem.

Edited by azlan3522
Link to comment
Share on other sites

<< Moving to MySQL Forum >>

 

What you are doing doesn't make sense, so I'm not sure what you are trying to accomplish. The STDDEV_SAMP() is a GROUP_BY (aggregate) function which assumes a list of values. Since $percent is also stored into the field 'percent', I assume it is a single value. So, there will not be a standard deviation. Please explain what you are trying to do and we might be able to help.

Link to comment
Share on other sites

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.