Nic*_*ich 1 mysql coldfusion cfquery cfqueryparam
这是我的查询.
<cfquery name="qryname" datasource="dsn">
UPDATE ticketlist
SET status = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="Expired">
WHERE expdatetime <
<cfqueryparam value = "#yourDate#" cfsqltype = "CF_SQL_DATE" maxLength = "19">
</cfquery>
Run Code Online (Sandbox Code Playgroud)
它能够给我所有结果,他们的expdatetime小于#yourdate#,唯一的问题是它只显示结果谁的差异是一整天,但不是那些差异在最小.因此,expdatetime的差异小于#thertime#by min's将不会显示在结果中,除非差异至少为一天.
如何针对最小精度优化此查询?
我知道两个可能有用的函数,DateDiff和DateCompare,但我不知道如何在查询中应用它们.
DateDiff("datepart","date1","date2")
DateCompare("date1","date2"[,"datePart"])
DatePart精确度
* s Precise to the second
* n Precise to the minute
* h Precise to the hour
* d Precise to the day
* m Precise to the month
* yyyy Precise to the year
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.
尝试使用CF_SQL_TIMESTAMP,即:
<cfqueryparam value = "#yourDate#" cfsqltype = "CF_SQL_TIMESTAMP">
Run Code Online (Sandbox Code Playgroud)
我不确定你是否需要这个maxlength属性.我发现CF映射需要是时间戳才能获得所需的精度.
| 归档时间: |
|
| 查看次数: |
580 次 |
| 最近记录: |