如何使用大于运算符的日期? [英] How to use greater than operator with date?

查看:154
本文介绍了如何使用大于运算符的日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不知道这里发生了什么。这是查询,从phpMyAdmin:

No idea what is going on here. Here is the query, right from phpMyAdmin:

SELECT * FROM `la_schedule` WHERE 'start_date' >'2012-11-18';

但是我一直在表中返回的所有记录,包括开始日期2012-11-01的记录。什么给了?

But I consistently get all records in the table returned, including those with start date 2012-11-01. What gives?

推荐答案

你已经使用单引号将$ code> start_date 要成为字符串,请使用 backtick 代替

you have enlosed start_date with single quote causing it to become string, use backtick instead

SELECT * FROM `la_schedule` WHERE `start_date` > '2012-11-18';




  • SQLFiddle Demo

    • SQLFiddle Demo
    • 这篇关于如何使用大于运算符的日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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