MariaDB [fechas]> select * from pagos where substr(fechaadquisicion,1,7) < ('2012-06') -> ; +--------+-------------------+------------------+ | identi | descripcion | fechaadquisicion | +--------+-------------------+------------------+ | 0004 | ram | 2012-03-27 | | 0006 | ups | 2012-03-25 | | 0007 | regulador voltaje | 2012-05-08 | | 0008 | cableado | 2012-04-24 | | 0010 | Escanner | 2012-03-21 | | 0011 | lapiz optico | 2012-02-12 | | 0013 | Procesador SN | 2012-04-14 | | 0015 | hub | 2012-01-16 | +--------+-------------------+------------------+ 8 rows in set (0.00 sec) MariaDB [fechas]> select * from pagos where substr(fechaadquisicion,1,7) < ('2012-06') ; +--------+-------------------+------------------+ | identi | descripcion | fechaadquisicion | +--------+-------------------+------------------+ | 0004 | ram | 2012-03-27 | | 0006 | ups | 2012-03-25 | | 0007 | regulador voltaje | 2012-05-08 | | 0008 | cableado | 2012-04-24 | | 0010 | Escanner | 2012-03-21 | | 0011 | lapiz optico | 2012-02-12 | | 0013 | Procesador SN | 2012-04-14 | | 0015 | hub | 2012-01-16 | +--------+-------------------+------------------+ 8 rows in set (0.00 sec) MariaDB [fechas]> select min(fechaadquisicion) from pagos; +-----------------------+ | min(fechaadquisicion) | +-----------------------+ | 2012-01-16 | +-----------------------+ 1 row in set (0.01 sec) MariaDB [fechas]> select identi,descripcion min(fechaadquisicion) from pagos; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'min(fechaadquisicion) from pagos' at line 1 MariaDB [fechas]> select descripcion min(fechaadquisicion) from pagos; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'min(fechaadquisicion) from pagos' at line 1 MariaDB [fechas]> select min(fechaadquisicion) from pagos; +-----------------------+ | min(fechaadquisicion) | +-----------------------+ | 2012-01-16 | +-----------------------+ 1 row in set (0.00 sec) MariaDB [fechas]> select * from pagos where fechaadquisicion = (select max(fechaadquisicion) from pagos); +--------+-------------+------------------+ | identi | descripcion | fechaadquisicion | +--------+-------------+------------------+ | 0021 | disco duro | 2013-11-22 | +--------+-------------+------------------+ 1 row in set (0.09 sec) MariaDB [fechas]> select * from pagos where descripcion like '%o' or descripcion like '%m'; +--------+--------------------+------------------+ | identi | descripcion | fechaadquisicion | +--------+--------------------+------------------+ | 0003 | teclado | 2012-06-04 | | 0004 | ram | 2012-03-27 | | 0008 | cableado | 2012-04-24 | | 0011 | lapiz optico | 2012-02-12 | | 0012 | Procedador pentium | 2012-06-19 | | 0021 | disco duro | 2013-11-22 | +--------+--------------------+------------------+ 6 rows in set (0.00 sec) +--------+-------------------+------------------+ | identi | descripcion | fechaadquisicion | +--------+-------------------+------------------+ | 0002 | mouse | 2013-07-29 | | 0003 | teclado | 2012-06-04 | | 0007 | regulador voltaje | 2012-05-08 | | 0008 | cableado | 2012-04-24 | | 0011 | lapiz optico | 2012-02-12 | | 0017 | Camara | 2013-03-18 | | 0020 | Fuente | 2013-07-11 | | 0021 | disco duro | 2013-11-22 | +--------+-------------------+------------------+ 8 rows in set (0.00 sec) MariaDB [fechas]> select * from pagos where descripcion not rlike '[aeiou]$'; +--------+--------------------+------------------+ | identi | descripcion | fechaadquisicion | +--------+--------------------+------------------+ | 0001 | Chasis | 2012-09-02 | | 0004 | ram | 2012-03-27 | | 0005 | Memoria usb | 2012-12-06 | | 0006 | ups | 2012-03-25 | | 0009 | Tablet | 2012-08-10 | | 0010 | Escanner | 2012-03-21 | | 0012 | Procedador pentium | 2012-06-19 | | 0013 | Procesador SN | 2012-04-14 | | 0014 | Unidad CD | 2012-09-17 | | 0015 | hub | 2012-01-16 | | 0016 | Multifuncional | 2013-04-15 | | 0018 | Board | 2013-01-13 | | 0019 | impresora laser | 2013-10-20 | +--------+--------------------+------------------+ 13 rows in set (0.01 sec) MariaDB [fechas]> select descripcion,fechaadquisicion, if(month(fechaadquisicion) <= 6, 'Plazo 5 Meses', 'Plazo 8 meses')'Plazo Pago' from pagos; +--------------------+------------------+----------------+ | descripcion | fechaadquisicion | Plazo Pago | +--------------------+------------------+----------------+ | Chasis | 2012-09-02 | Plazo 8 meses | | mouse | 2013-07-29 | Plazo 8 meses | | teclado | 2012-06-04 | Plazo 5 Meses | | ram | 2012-03-27 | Plazo 5 Meses | | Memoria usb | 2012-12-06 | Plazo 8 meses | | ups | 2012-03-25 | Plazo 5 Meses | | regulador voltaje | 2012-05-08 | Plazo 5 Meses | | cableado | 2012-04-24 | Plazo 5 Meses | | Tablet | 2012-08-10 | Plazo 8 meses | | Escanner | 2012-03-21 | Plazo 5 Meses | | lapiz optico | 2012-02-12 | Plazo 5 Meses | | Procedador pentium | 2012-06-19 | Plazo 5 Meses | | Procesador SN | 2012-04-14 | Plazo 5 Meses | | Unidad CD | 2012-09-17 | Plazo 8 meses | | hub | 2012-01-16 | Plazo 5 Meses | | Multifuncional | 2013-04-15 | Plazo 5 Meses | | Camara | 2013-03-18 | Plazo 5 Meses | | Board | 2013-01-13 | Plazo 5 Meses | | impresora laser | 2013-10-20 | Plazo 8 meses | | Fuente | 2013-07-11 | Plazo 8 meses | | disco duro | 2013-11-22 | Plazo 8 meses | +--------------------+------------------+----------------+ 21 rows in set (0.00 sec)