告诉我这个简单的查询 [英] telll me this simple query

查看:67
本文介绍了告诉我这个简单的查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨......
请告诉我查询
通过选择从"和到"日期,数据应从sql中的数据库中显示.
感谢

hi....
please tell me query for
By selecting "from" and "to" date data should display from database in sql

thanks

推荐答案

SELECT * FROM myTable WHERE dateField BETWEEN @STARTDATE AND @ENDDATE

请注意,这是包含的,您应该提供@STARTDATE和@ENDDATE作为参数作为DateTime值.

BETWEEN不是函数,白痴男孩! -修复了OriginalGriff [/edit]

Note that this is inclusicve, and you should provide @STARTDATE and @ENDDATE as parameters as DateTime values.

[edit]BETWEEN is not a function, idiot boy! - Fixed OriginalGriff[/edit]


请尝试以下操作:

try this:

<br />
select * from tablename where mydate between fromdate and todate;



希望对您有所帮助:)

有关更多查询,请在此处评论!!!



hope it helps :)

for further queries comment here!!


您可以尝试使用自定义的日期格式

you can try this with customized date format

SELECT * FROM Tablename WHERE (format(Date, 'dd-mm-yyyy') BETWEEN format(?, 'dd-mm-yyyy') AND format(?, 'dd-mm-yyyy'))


这篇关于告诉我这个简单的查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆