Timeline for How do I create a user-defined aggregate function in MySQL (redux)?
Current License: CC BY-SA 3.0
18 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 13, 2017 at 12:43 | history | edited | CommunityBot |
replaced http://dba.stackexchange.com/ with https://dba.stackexchange.com/
|
|
S Dec 17, 2014 at 2:50 | history | bounty ended | Paul White♦ | ||
S Dec 17, 2014 at 2:50 | history | notice removed | Paul White♦ | ||
Dec 10, 2014 at 17:50 | comment | added | Hartmut Holzgraefe | What would be the expected average if there are only two quiz grades or less? | |
S Dec 10, 2014 at 12:24 | history | bounty started | Paul White♦ | ||
S Dec 10, 2014 at 12:24 | history | notice added | Paul White♦ | Draw attention | |
Dec 9, 2014 at 4:17 | answer | added | Jeffrey Rolland | timeline score: 1 | |
Dec 8, 2014 at 22:34 | comment | added | user1822 | Btw: I don't really understand your requirement. There are only two scores for each student in your example data. If you "drop" them, nothing is left to calculate the average | |
Dec 8, 2014 at 22:26 | comment | added | user1822 | Is upgrading to Postgres an option? You can easily write aggregates in PL/pgSQL there. But for the problem at hand I think you wouldn't even need a custom aggregate. Some clever use of window functions will probably solve this. | |
Dec 8, 2014 at 20:37 | history | edited | Jeffrey Rolland | CC BY-SA 3.0 |
added 6 characters in body
|
Dec 8, 2014 at 20:35 | answer | added | Jeffrey Rolland | timeline score: 0 | |
Dec 8, 2014 at 2:42 | comment | added | Jeffrey Rolland | In the interests of learning how to fish, I have successfully compiled and installed a "Hello, World!" UDF (user-defined function) for MySQL <drive.google.com/…>. The hello_world.so file (after being complied with "gcc -shared -o hello_world.so -I /usr/include/mysql hello_world.c" [without the quotes]) should be stored in /usr/lib/mysql/plugins/ with 755 permissions on Ubuntu linux systems. [The "-I /usr/include/mysql" is the path to the mysql header files; I found my code wouldn't compile without this parameter, but YMMV.] | |
Dec 8, 2014 at 1:28 | comment | added | Michael - sqlbot | If you know how to write in C, user-defined aggregate functions are very easy, because MySQL does the grouping, then throws row values at it for each group, and asks it for the result... where "it" is the UDF code. Using it would be even easier than what you imagine above. But that's if you're proficient in C/C++, the only UDF environment supported. | |
Dec 7, 2014 at 21:32 | history | tweeted | twitter.com/#!/StackDBAs/status/541706805077106688 | ||
Dec 7, 2014 at 18:46 | review | First posts | |||
Dec 7, 2014 at 20:28 | |||||
Dec 7, 2014 at 18:41 | comment | added | Jeffrey Rolland | OK, adding UDF's looks a little complicated; it might help if I had access to the MIN GROUP BY function's source code. Getting the C/C++ code compiled for an OS looks like a wizard's domain, in addition. If I do come up with a UDF for a SMALL GROUP BY function, I promise to post the code. | |
Dec 7, 2014 at 18:40 | comment | added | Jeffrey Rolland | I'll look at this tomorrow and post a real answer if I come up with anything dev.mysql.com/doc/refman/5.1/en/adding-udf.html | |
Dec 7, 2014 at 18:38 | history | asked | Jeffrey Rolland | CC BY-SA 3.0 |