在列名明智的帮助下显示两个日期数据 [英] show between two dates data with the help of column name wise
本文介绍了在列名明智的帮助下显示两个日期数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的,
i希望在两个日期之间显示数据,借助列名明智地使用sql server
i尝试了很多其他方式,但不是。所以请指导我的解决方案。
请指导我这是否可以获得以下查询的输出?
例如:
dear all,
i want to show between two dates data with the help of column name wise using sql server
i tried many other ways but am not. so please guide me for my solution.
please guide me is this possible to get output for the below query?
for example:
declare @fromdate datetime,@todate datetime
select @fromdate='2015-11-06 11:59:48.000', @todate='2015-11-11 13:22:27.000'
select * from BillDetails1 where ProductName ='chokalate' between @fromdate and @todate
但我无法得到结果,代表我得到以下错误,
错误:
but am unable to get the result, on behalf of that am getting the below error,
error:
Incorrect syntax near the keyword 'between'.
提前感谢..
thanks in advance..
推荐答案
你需要一个AND加上一个列名:
You need an AND plus a column name:
select * from BillDetails1 where ProductName ='chokalate' AND MyDateColumn between @fromdate and @todate
这篇关于在列名明智的帮助下显示两个日期数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文