我可以在SQL中执行此操作吗? [英] Can I do this in SQL?

查看:52
本文介绍了我可以在SQL中执行此操作吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

检查另一个查询中2个日期之间的日期?



Check the date between 2 dates in another query?

Select * From TableName Where myDate Between (Select myFromDate,myTodate From AnotherTableName where id=3)

推荐答案

Select * From TableName Where myDate Between (Select myFromDate From AnotherTableName where id=3) and (Select myTodate From AnotherTableName where id=3)






试试这个...



Hi,

Try this...

DECLARE @FrDate Datetime
DECLARE @ToDate Datetime

Select @FrDate=myFromDate, @ToDate=myTodate From AnotherTableName where id=3

Select * From TableName Where myDate Between @FrDate AND @ToDate







希望这对你有帮助。





干杯




hope this will help you.


Cheers


这篇关于我可以在SQL中执行此操作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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