I have an sql query that leads me, I have two tables not linked to each other, of which I want to select users whose year of birth is between the year of beginning of the category and the final year. These are the tables:
CREATE TABLE IF NOT EXISTS usuarios (
id_usuario int(11) NOT NULL auto_increment,
use_nombre varchar(50) COLLATE utf8_unicode_ci NULL,
use_apellidos varchar(100) COLLATE utf8_unicode_ci NULL,
use_direccion varchar(100) COLLATE utf8_unicode_ci NULL,
use_codigo_postal int(5) NULL,
use_telefono1 int(9) NULL,
use_telefono2 int(9) NULL,
Use_año_nacimiento int(11) NULL, /* esta es la referencia */
Use_DNI varchar(9) NULL, /* -- dni con letra */
PRIMARY KEY (Id_usuario) )
ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;
Inquiry2:
CREATE TABLE IF NOT EXISTS categorias
(
id_categoria INT(11) NOT NULL auto_increment,
id_modalidad INT(11) NOT NULL,
nombre_categoria VARCHAR(50) CHARACTER SET utf8 COLLATE
utf8_unicode_ci OT NULL,
año_inicio_categoria INT(11) NULL, /* y estos son los campos que hay que utilizar para el filtro */
año_fin_categoria int(11) NULL
PRIMARY KEY (id_categoria)
)
engine=innodb DEFAULT charset=utf8 COLLATE=utf8_unicode_ci auto_increment=1;
Greetings