|
 |
|
ปัญหาตรวจสอบวันที่เฉพาะเดือนและพ.ศ. ที่เก็บเป็น varchar รูปแบบ 12 Feb 2009 |
|
 |
|
|
 |
 |
|
ไม่ทราบว่าใช้ phpmyadmin หรือป่าวครับ ถ้าใช้จะเข้าไปแก้ไขง่ายหน่อย ตามรูปเลยครับ

|
 |
 |
 |
 |
Date :
2009-05-06 12:00:09 |
By :
kanchen |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
select right(ฟิวด์วันที่,8) from ตาราง
เช่น
select right(date,8) from tbl_date
--------------------------------------------------------
หมายเหตุ 8 คือ จำนวน digit ของเดือนครับ
ลองเอาไปเป็นแนวทางดูครับ หรือจะ mid ก็ได้ครับ
|
 |
 |
 |
 |
Date :
2009-05-06 12:05:49 |
By :
panyapol |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอ่อ คือ ไม่ใช่แก้ไขตารางนะค่ะ คือ ถ้าจะselect ข้อมูลเช่น select * from table where tdate="$d $m $y" " แบบนี้อ่ะค่ะ
|
 |
 |
 |
 |
Date :
2009-05-06 12:09:27 |
By :
ioff |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
SELECT *, STR_TO_DATE(tdate,'%Y-%m-%d') AS new_date FROM table WHERE new_date = '2009-05-06'
ถ้าเป็น v. 4.1 ขึ้นไปนะ ลองดู ผมก็ไม่เคยใช้ แต่ใน manual มันมี
|
 |
 |
 |
 |
Date :
2009-05-06 12:15:28 |
By :
plakrim |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|