Ver Mensaje Individual
  #7 (permalink)  
Antiguo 09/09/2009, 06:49
manupalaya
 
Fecha de Ingreso: enero-2007
Mensajes: 156
Antigüedad: 17 años, 3 meses
Puntos: 3
Respuesta: Consulta Mysql - Solo suma una fila

aaah!

te adjunto lo que necesitas:

Código:
CREATE TABLE IF NOT EXISTS `employee` (
  `emp_id` int(11) NOT NULL auto_increment,
  `active` tinyint(1) default NULL,
  `banco_id` smallint(6) NOT NULL default '0',
  `id_categoria_gastos` smallint(6) default NULL,
  `id_categoria_ingresos` smallint(6) NOT NULL default '1',
  `id_categoria_nombres` smallint(100) NOT NULL default '0',
  `Fecha` date NOT NULL default '0000-00-00',
  `Ingresos` float NOT NULL default '0',
  `Gastos` float NOT NULL default '0',
  `Diferencia` mediumtext NOT NULL,
  PRIMARY KEY  (`emp_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=723 ;

--
-- Volcar la base de datos para la tabla `employee`
--

INSERT INTO `employee` (`emp_id`, `active`, `banco_id`, `id_categoria_gastos`, `id_categoria_ingresos`, `id_categoria_nombres`, `Fecha`, `Ingresos`, `Gastos`, `Diferencia`) VALUES
(218, NULL, 5, 217, 100, 0, '2009-07-02', 0, 2999, '-147'),
(219, NULL, 5, 100, 145, 0, '2009-07-03', 30, 0, '-147'),
(254, NULL, 2, 167, 100, 0, '2009-06-01', 0, 170, '-147'),
(253, NULL, 4, 100, 132, 0, '2009-06-20', 51.25, 0, '-147'),
(252, NULL, 2, 167, 100, 0, '2009-06-01', 0, 70, '-147'),
(251, NULL, 4, 100, 133, 0, '2009-06-19', 136.57, 0, '-147'),
(250, NULL, 2, 167, 100, 0, '2009-06-01', 0, 170, '-147'),
(249, NULL, 4, 100, 132, 0, '2009-06-13', 4, 0, '-147'),
(248, NULL, 2, 170, 100, 0, '2009-06-01', 0, 1.19, '-147'),
(247, NULL, 4, 100, 147, 0, '2009-06-13', 13, 0, '-147'),
(245, NULL, 2, 192, 100, 0, '2009-06-01', 0, 220.59, '-147'),
(244, NULL, 4, 100, 133, 0, '2009-06-19', 0, 0, '-147'),
(242, 0, 4, 100, 147, 0, '2009-06-06', 11.5, 0, '-147'),
(256, NULL, 4, 100, 147, 0, '2009-06-24', 28, 0, '-147'),
(257, NULL, 4, 100, 147, 0, '2009-06-26', 31, 0, '-147'),
(258, NULL, 4, 100, 147, 0, '2009-06-27', 14, 0, '-147'),
(259, NULL, 4, 100, 146, 0, '2009-07-02', 16, 0, '-147'),
(524, NULL, 1, 100, 134, 0, '2009-04-26', 4, 0, '-147'),
(525, NULL, 1, 120, 114, 0, '2009-07-01', 54, 31.32, '-147');
muchas, muchas gracias