mysql datetime格式错误. [英] Mysql datetime format error.

查看:102
本文介绍了mysql datetime格式错误.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想通过在where子句中指定日期来从数据库获取记录
例如:
选择学生的姓名,住所地址=> 2012-02-22''
它没有得到记录,因为在数据库中

Hi,

I want to get records from database by giving date in where clause
eg:
select stuname,address from student where admissiondate =''2012-02-22''
It did not get the record because in database the

admissiondate is in datetime format(using MySql). 



我该如何解决这个问题.



how can i overcome this problem.

推荐答案

尝试以下查询:
Try the following queries:
select stuname,address from student where admissiondate = '2012-02-22 00:00:00'
OR
select stuname,address from student where Date(admissiondate) = '2012-02-22'


这篇关于mysql datetime格式错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆