wert
05-26-2003, 05:33 PM
I don't know why this query gives me all the rows in my table Transacciones? does any one know why? here is the query:
//this is my table:
mysql> desc transacciones;
+----------+-------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------------+------+-----+---------+-------+
| Fecha | date | YES | | NULL | |
| Hora | time | YES | | NULL | |
| Monto | bigint(20) | YES | | NULL | |
| Tienda | int(11) | YES | | NULL | |
| Concepto | enum('R','V','D') | YES | | NULL | |
+----------+-------------------+------+-----+---------+-------+
5 rows in set (0.10 sec)
//and this is the query:
select * from transacciones where (fecha <= CURRENT_DATE) and ( fecha >= DATE_SUB(fecha, INTERVAL 3 DAY));
it supose to return only the transactions from three days a go to now, but it gives me all the table's rows, I just don't get it.
Please help!
//this is my table:
mysql> desc transacciones;
+----------+-------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------------+------+-----+---------+-------+
| Fecha | date | YES | | NULL | |
| Hora | time | YES | | NULL | |
| Monto | bigint(20) | YES | | NULL | |
| Tienda | int(11) | YES | | NULL | |
| Concepto | enum('R','V','D') | YES | | NULL | |
+----------+-------------------+------+-----+---------+-------+
5 rows in set (0.10 sec)
//and this is the query:
select * from transacciones where (fecha <= CURRENT_DATE) and ( fecha >= DATE_SUB(fecha, INTERVAL 3 DAY));
it supose to return only the transactions from three days a go to now, but it gives me all the table's rows, I just don't get it.
Please help!