本文介绍了sql从和到目前为止的相对值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨Frds早上好,
我使用"From Date"和"To Date"从表中检索值.....我使用此查询
Hi Frds Good Morning,
I have a retrieve values from table by using "From Date" and "To Date".....I used this query
select Invoice_Date,Sub_Total from Sales_Master where Customer_ID='1' and Invoice_Date >='8/01/2012 2:42:36 PM' and Invoice_Date <='8/13/2012 2:42:36 PM'
但在此查询中它没有检索到8月1日...显示8月2日至8月13日...但是我需要从8月1日至8月13日
but in this query its not retrieving 1st august ...Display 2nd august to 13 august...But I need from 1st August to 13th August
推荐答案
select convert(Datetime, CONVERT(VARCHAR(10),Invoice_Date ,105),105) as Invoice_Date
from tblInvoice
where convert(Datetime, CONVERT(VARCHAR(10),Invoice_Date ,105),105)>='8/01/2012'
and convert(Datetime, CONVERT(VARCHAR(10),Invoice_Date ,105),105)<='8/13/2012'
祝您编码愉快!
:)
Happy Coding!
:)
select Invoice_Date,Sub_Total from Sales_Master where Customer_ID='1' and Invoice_Date >='01 Aug 2012 00:00:00' and Invoice_Date <='13 Aug 2012 23:59:59'
-Vijay
-Vijay
这篇关于sql从和到目前为止的相对值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!