Help with AVG query
Hi every: I have this table: smp_evaluacion --- id_evaluacion eval1 eval2 eval3 eval4 eval5 This is for a rating system. I need to build a query for retrieve the best rating files. Normally with PHP I add every field, I mean (eval1, eval2, eval3, eval4, eval5) and then divide this result by 5, like a average. I know that SQL can do this directly using AVG function but I don't know how. Can any help me? Cheers and thanks in advance Reynier Pérez Mira 5to. año Ing. Informática Universidad de las Ciencias Informáticas
Problems with MySQL Migration Toolkit
I have downloaded sucesfully the MySQL Migration Toolkit tool. After start the error with Java appears. I have Java installed on my PC because I work with Eclipse 3.1.1 + PHPEclipse Plugin. The JDK installed is 1.5. So if any can help me ... Regards, -- ReynierPM 4to. Ing. Informática Linux User: #310201 El programador superhéroe aprende de compartir sus conocimientos. Es el referente de sus compañeros. Todo el mundo va a preguntarle y él, secretamente, lo fomenta porque es así como adquiere su legendaria sabiduría: escuchando ayudando a los demás... -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
mysqldump command
I try to create a cron in Linux (Debian Sarge) and the content for this cron is a mysql database backup. I read documentation about mysqldump command and use, but I forgot something because it not works for me. I put this in bash: # mysqldump --opt -c -C dp > /var/tmp_save/dproject.sql But when I open .sql file none INSERT statement was added. Is wrong my command or ... Regards, -- ReynierPM 4to. Ing. Informática Linux User: #310201 El programador superhéroe aprende de compartir sus conocimientos. Es el referente de sus compañeros. Todo el mundo va a preguntarle y él, secretamente, lo fomenta porque es así como adquiere su legendaria sabiduría: escuchando ayudando a los demás... -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Help with query optimization & query SUM
Hi: I'm develop a simple shopping cart. I have this two tables: carro_de_compras -- IDU int(11) NOT NULL IDA int(11) NOT NULL CantidadDeArticulos int(11) NOT NULL os_articulo -- IDA int(11) NOT NULL auto_increment, IDC int(11) NOT NULL default '0', ANombre varchar(200) NOT NULL default '', ADescripcion text, ACantidad int(11) NOT NULL default '0', AImagen varchar(50) default NULL, IDU int(11) NOT NULL default '0', APrecio float(6,2) default NULL, KEY AI_IDA (`IDA`) Before ask let me explain some things. As you can see in the tables I have the same field IDU in both tables. So in first(table carro_de_compras) it means is user ID loged on ecommerce system, the second is the user ID who upload articles for sale. Something like eBay in wich you can sale and buy at every time. The arrive the point in wich I need to optimize queries: PHP Code: - $sql = mysql_query("SELECT * FROM carro_de_compras"); $sresultado = mysql_fetch_assoc($sql); $query = mysql_query("SELECT * FROM os_articulo WHERE (IDA='".$sresultado['IDA']."')"); while ($record = mysql_fetch_assoc($query)) { $productos[] = $record; } The question for this problem is: exists any way to optimize this query and leave only in one line? I read in MySQL doc about it and found some about JOIN but I can't understand how it works. Maybe because I'm cuban and not understand english as well as I want. The other questions is how to add some values to a field. For example: $sql = mysql_query("UPDATE table SET value=value+1" WHERE id='1'); For do this query I do this: $sql = mysql_query("SELECT value FROM table WHERE id='1'"); $result = mysql_query($sql); $update = mysql_query("UPDATE table SET (value='".$result['value']."' + 1) WHERE id='1'); So is possible to optimize this query? Regards ReynierPM 4to. año Ing. Informática Usuario registrado de Linux: #310201 * El programador superhéroe aprende de compartir sus conocimientos. Es el referente de sus compañeros. Todo el mundo va a preguntarle y él, secretamente, lo fomenta porque es así como adquiere su legendaria sabiduría: escuchando ayudando a los demás... -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
MySQL 5.0.15 in Linux OS
Hi list: Recently I download MySQL source from MySQL.com site for install it in my Linux Server. I follow the standard procedure for it, means: shell> ./configure shell> make shell> make install I read the online documentation looking if I need some configuration changes and see that for execute MySQL I need run this command: shell> /usr/local/bin/mysqld_safe but when I execute them nothing happend. Just this error appear Starting mysqld daemon with databases from /usr/local/var STOPPING server from pid file /usr/local/var/SPL.pid 060114 18:12:04 mysqld ended ¿Anybody knows how to solve it? I have another doubt. How I can setup MySQL for Stara automatically when I restart my Linux Server? I installed Apache and MySQL in the same way, but when I restart the OS, I need to run this two command for start process: shell> /usr/local/bin/mysqld_safe (this for MysQL not working yet) shell> /usr/local/apache2/bin/apachectl start (this for Apache working fine) I know that in Linux exists a way to do this but not know how to setup. If any can help me I thank every day Ah!!! My Linux Distro is Debian Sarge 3.1 Stable Best, ReynierPM 4to. año Ing. Informática Usuario registrado de Linux: #310201 * El programador superhéroe aprende de compartir sus conocimientos. Es el referente de sus compañeros. Todo el mundo va a preguntarle y él, secretamente, lo fomenta porque es así como adquiere su legendaria sabiduría: escuchando ayudando a los demás... -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Query How To
Hi list I need to make a Quero that select all fields in wich the date are inferior in 10 days to actual date. Something like this: Actual date: 18-04-2005 Select all fields in which are bigger than: 08-04-2005. How can I do this? Regards Reynier Pérez Mira 3ero. Ing. Informática Entre más inteligente me siento, más me doy cuenta de lo ignorante que soy.