Ver Mensaje Individual
  #5 (permalink)  
Antiguo 04/02/2016, 17:37
Avatar de bandolera
bandolera
 
Fecha de Ingreso: abril-2009
Mensajes: 613
Antigüedad: 15 años
Puntos: 7
Respuesta: Agrupar y Grabar

Cita:
Iniciado por Libras Ver Mensaje
Claro que si, seria algo como esto:

Código MySQL:
Ver original
  1. update saldos
  2. set cantidad=t1.total
  3. SELECT codigo, COUNT(codigo) as total
  4. FROM movi
  5. GROUP BY codigo
  6. HAVING COUNT(codigo)>0  ) as t1 where saldos.codigo=t1.codigo
Me sale este error:
Código HTML:
 #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from( SELECT codigo, COUNT(codigo) as total FROM movi GROUP BY codigo HAVI' at line 3
__________________
Todos somos iguales. NO! a la violencia de género.