あなたがしていることはうまくいくはずです。私は仕事でいつもこのような日付フィールドから選択します。
mysql> create table contracts (indate date);
Query OK, 0 rows affected (0.02 sec)
mysql> insert into contracts values ('2012-10-06'), ('2012-11-04'), ('2012-09-17');
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> set @from_date = '2012-10-01';
Query OK, 0 rows affected (0.00 sec)
mysql> set @to_date = '2012-10-31';
Query OK, 0 rows affected (0.00 sec)
mysql> select * from contracts where indate >= @from_date and indate <= @to_date;
+------------+
| indate |
+------------+
| 2012-10-06 |
+------------+
1 row in set (0.00 sec)
もちろん、ここではmysql変数を使用しましたが、何もありません。文字列が含まれているだけです。代わりにこれを行うことができます:
mysql> select * from contracts where indate >= '2012-10-01' and indate <= '2012-10-31';
+------------+
| indate |
+------------+
| 2012-10-06 |
+------------+
1 row in set (0.00 sec)
OPは正しいですが、BETWEENははるかに簡潔です。
mysql> select * from contracts where indate between '2012-10-01' and '2012-10-31';
+------------+
| indate |
+------------+
| 2012-10-06 |
+------------+
1 row in set (0.00 sec)
日付比較の魔法は、フィールドが日付型であるためです。