我可以在SQL中执行此操作吗

我可以在SQL中执行此操作吗

本文介绍了我可以在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)


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中执行此操作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-04 16:12