本文介绍了如何从datetime字段获取日期并在select语句中使用该日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从datetime字段获取日期并在select语句中使用该日期::





i有一个表summ与coumn名称Date_Time数据类型:datetime有记录如

2006-04-28 00:39:32.000。

现在我想要提取所有日期的记录:2006 -04-28。



无论时间是什么。没有时间准时。只应检查日期。







从summ中选择*,其中Date_Time = ________________。

how to get date from datetime field and use that date in select statement::


i have a table summ with coumn name Date_Time of datatype: datetime having record like
2006-04-28 00:39:32.000.
now i want to extract all fields of only those records having date :2006-04-28.

whatever the time may be.no condition on time.only date should be checked.



select * from summ where Date_Time=________________.

推荐答案

SELECT * FROM summ WHERE CONVERT(date, Date_Time)='2006-04-28'





[edit]从表达式中删除==,SQL仅为=。 :doh: - OriginalGriff [/ edit]



[edit] Removed "==" from expression, SQL is "=" only. :doh: - OriginalGriff[/edit]


这篇关于如何从datetime字段获取日期并在select语句中使用该日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 07:26
查看更多