Ver Mensaje Individual
  #23 (permalink)  
Antiguo 02/12/2015, 12:36
Gustavo1973
 
Fecha de Ingreso: abril-2007
Ubicación: Merlo
Mensajes: 314
Antigüedad: 17 años, 1 mes
Puntos: 3
Respuesta: Cantidad de registro en una búsqueda mysql

Estructura y datos
Código MySQL:
Ver original
  1. CREATE TABLE `prueba` (
  2.   `id` bigint(11) NOT NULL DEFAULT '0',
  3.   `codigo` varchar(20) DEFAULT NULL,
  4.   `descripcion` varchar(255) DEFAULT NULL,
  5.   `marca` varchar(150) DEFAULT NULL,
  6.   `precio` float(8,2) DEFAULT NULL,
  7.   `rubro` varchar(150) DEFAULT NULL,
  8.   `subrubro` varchar(150) DEFAULT NULL,
  9.   PRIMARY KEY (`id`)
  10.  
  11. INSERT INTO `prueba` VALUES (1,'AUC0190','PLUG 2.5MM MONO PLAST.C/COLITA','JA',1.64,'','\r\n')
  12.  
  13. CREATE TABLE `marca` (
  14.   `Id` int(11) NOT NULL AUTO_INCREMENT,
  15.   `descripcion` varchar(120) DEFAULT NULL,
  16.   `id_rubro` int(11) DEFAULT NULL,
  17.   `id_subrubro` int(11) DEFAULT NULL,
  18.   `estado` int(1) unsigned DEFAULT '1',
  19.   PRIMARY KEY (`Id`)
  20.  
  21. INSERT INTO `marca` VALUES (779,'JA',0,0,1)
  22.  
  23. CREATE TABLE `rubro` (
  24.   `Id` int(11) NOT NULL AUTO_INCREMENT,
  25.   `descripcion` varchar(120) DEFAULT NULL,
  26.   `estado` int(1) unsigned DEFAULT '1',
  27.   PRIMARY KEY (`Id`)
  28.  
  29. INSERT INTO `rubro` VALUES (1,'ACCES. CABLEADO',1)
  30.  
  31. CREATE TABLE `subrubro` (
  32.   `Id` int(11) NOT NULL AUTO_INCREMENT,
  33.   `descripcion` varchar(120) DEFAULT NULL,
  34.   `id_rubro` int(11) DEFAULT NULL,
  35.   `estado` int(1) unsigned DEFAULT '1',
  36.   PRIMARY KEY (`Id`)
  37.  
  38. INSERT INTO `subrubro` VALUES (1,'AISLADORES DE BARRA\r\n',1,1),
  39.  
  40. CREATE TABLE `productos` (
  41.   `id_productos` bigint(8) unsigned NOT NULL AUTO_INCREMENT,
  42.   `titulo` varchar(60) DEFAULT NULL,
  43.   `codigo` varchar(16) DEFAULT NULL,
  44.   `estado` int(1) unsigned DEFAULT '1',
  45.   `id_rubro` int(4) unsigned DEFAULT '0',
  46.   `id_subrubro` varchar(255) DEFAULT NULL,
  47.   `id_marca` varchar(255) DEFAULT NULL,
  48.   `precio` float NOT NULL DEFAULT '0',
  49.   PRIMARY KEY (`id_productos`),
  50.   KEY `id_productos` (`id_productos`)
  51. ) ENGINE=MyISAM DEFAULT CHARSET=latin1;