如何在开始和结束日期之间找到所有列值?例外输出

时间:2016-08-25 08:13:07

标签: mysql

我运行查询

mvn clean package -Prelease-profile

结果如下图所示。

image

但我希望在“2016-08-25”和“2016-08-28”之间找到所有let array = ["1", "a", "b", "z", "3", "!"] let sortedArray = array.sort { (firstObject, secondObject) -> Bool in let firstIsNumber = firstObject.rangeOfCharacterFromSet(NSCharacterSet.decimalDigitCharacterSet())?.count > 0 let secondIsNumber = secondObject.rangeOfCharacterFromSet(NSCharacterSet.decimalDigitCharacterSet())?.count > 0 if firstIsNumber != secondIsNumber {return secondIsNumber} return firstObject < secondObject } print(sortedArray) //["!", "a", "b", "z", "1", "3"] 的值1

如果我这样使用

SELECT * FROM roomcalendar where day between '2016-08-25' and '2016-08-28'

它显示1行

我需要检查avaroom所有的开始和结束日期。

怎么做?

1 个答案:

答案 0 :(得分:1)

问题是你想要的结果是什么?

YES

如果有任何与avaroom&lt;&gt;的记录,则会返回SELECT * FROM roomcalendar t WHERE NOT EXISTS(SELECT 1 FROM roomcalendar s WHERE s.day between '2016-08-25' and '2016-08-28' AND s.avaroom <> 0) AND t.day between '2016-08-25' and '2016-08-28' 0,如果没有则为NULL。

如果您想选择全部,但仅限于没有avaroom&lt;&gt; 0存在,然后:

{{1}}