简体   繁体   English

如何从日期(格式星期一)大于今天的行中获取数据

[英]how to get data from rows where date(format monyy) is greater than today

I have a database with a column listing the dates as MONYY ex. 我有一个数据库,其中有一个列,列出的日期为MONYY ex。 FEB05,JUN12, etc. I want to get data from rows with date>= today. FEB05,JUN12等。我想从日期> =今天的行中获取数据。 I tried using to_date as below 我尝试如下使用to_date

select t.date, t.data, to_date(t.date, 'monyy') from table t
   where to_date(t.date,'monyy') >='8/1/2012'

But I get error saying that FROM keyword is not at expected location. 但是我收到错误消息,说FROM关键字不在预期的位置。

Need help in writing this query. 在编写此查询时需要帮助。

table is a reserved word and not a valid table name. table是保留字,不是有效的表名。 Exchange table for the actual name of your table. tabletable的实际名称。

Edit: I tried it, and it worked if I changed the final date to: 编辑:我尝试过,并且如果我将最终日期更改为:

to_date('8/1/2012', 'mm/dd/yyyy')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Microsoft SQL Server 2008 获取日期比今天的日期大 6 个月的所有记录? - How do I get all records where date is 6 months greater than today's date, using Microsoft SQL Server 2008? 获取日期小于今天的行数 - Get count of rows where date is less than today 如何选择日期大于另一行中日期的行? - How to select rows where date is greater than the date in another row? 如何仅从SQL Server的XML列中检索日期大于今天的日期的行? - How can I only retrieve rows with dates greater than today's date from an XML column in SQL Server? 如何获取两列日期之一应大于给定日期的行数 - How to get the Count of rows where either of two columns dates should be greater than a given date 如何从保存的日期大于另一个日期+ 1周的数据库中获取数据 - How to get data out of a database where the saved date is greater than another date + 1 week sql获取日期大于当前月份的数据 - sql get data where date is greater than current month 选择最大日期到当前日期的行以及所有大于今天日期的行 - select rows with max date till current date as well as all the rows greater than today date 日期时间大于今天的 MySQL - MySQL Where DateTime is greater than today 检查房间数据库中的日期是否大于今天 - Check is date is greater than today in Room database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM