I'm doing a query on mysql, which should make me based on a given id and a range of dates, bring me the records between those dates. I'm starting to learn mysql so the most sure thing is that I'm formulating everything wrong.
This is being implemented in a C # program. That part is already there and everything works, the only thing is that I do not know how to make the consulate, it occurred to me also to only perform the query of the id and through c # filter the dates of the DateTimePicker, but I do not think it's optimal if I can directly do this in the mysql query.
and tried this but it does not work:
select * from registro_ausentismos where id = '381' AND (fecha_inicio between >= '2018-09-10' AND fecha_final between <= '2018-09-30')
I think that with the following image I can understand a little more:
There we see that what I do is ask for an employee code and a range of dates, I need to show the records between the selected dates, I do not know if that filter can be made directly from a MySQL consulate.
CREATE TABLE 'registro_ausentismos' ( 'id' INT(11) NOT NULL, 'nombre' VARCHAR(250) NOT NULL, 'apellidos' VARCHAR(250) NOT NULL, 'tipo_documento' VARCHAR(50) NOT NULL, 'numero_documento' BIGINT(20) NOT NULL, 'eps' VARCHAR(250) NOT NULL, 'cda' VARCHAR(50) NOT NULL, 'cargo' VARCHAR(50) NOT NULL, 'numero_incapacidad' INT(11) NOT NULL AUTO_INCREMENT, 'tipo_evento' VARCHAR(50) NOT NULL DEFAULT '0', 'dias_incapacidad' INT(11) NOT NULL DEFAULT '0', 'fecha_inicio' DATE NOT NULL, 'fecha_final' DATE NOT NULL, 'codigo_diagnostico' VARCHAR(50) NOT NULL DEFAULT '0', 'valor_incapacidad' INT(10) NULL DEFAULT '0', PRIMARY KEY ('numero_incapacidad', 'id') ) COLLATE='latin1_swedish_ci' ENGINE=InnoDB AUTO_INCREMENT=45656656 ;
and that is the table where the records are being stored.