 |
|
เขียนแบบนี้ครับ
$sql="SELECT * FROM customer where concat(mid(customer_date,7,4),'-',mid(customer_date,4,2),'-',mid(customer_date,1,2)) between concat(mid('$start_date',7,4),'-',mid('$start_date',4,2),'-',mid('$start_date',1,2)) and concat(mid('$end_date',7,4),'-',mid('$end_date',4,2),'-',mid('$end_date',1,2)) ";
เห็นแบบนี้แล้วต้องเลือกครับว่าจะเปลี่ยนรูปแบบการจัดเก็บหรือเปล่า
ถึงจะใช้ varchar yyyy-mm-dd พอได้ แต่ควรจะเก็บเป็น date ครับซึ่งจะสามารถนำไปคำนวนได้ด้วยครับ
|
 |
 |
 |
 |
Date :
2010-11-14 12:53:17 |
By :
... |
|
 |
 |
 |
 |
|
|
 |