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.

Link to comment
https://forums.phpfreaks.com/topic/280448-mysql-query-help/
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
https://forums.phpfreaks.com/topic/280448-mysql-query-help/#findComment-1441960
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.