mssql的sql语句 [英] sql statement by mssql
本文介绍了mssql的sql语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想写一下查询声明
在60天内从价格表中选择最新日期的价格
谢谢,
thanda
I want to write the query statement for
select the price by latest date from Price table within the 60 days
thanks,
thanda
推荐答案
试试这个
try this
select price from price_table where DATEDIFF(DAY,[OrderDate],GETDATE()) <= 60
如果orderDate字段类型为dataTime且表中存在匹配字段。修改适合您要求的表名和字段名。
provided the orderDate field type is dataTime and matching field exists in your table. modify the table name and field name that suits to your requirement.
这篇关于mssql的sql语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文