我被困在一条SQL语句上。我正在尝试获取以下内容:
从rentedTab的WHERE中选择字段属性与propertyIDTr相匹配
AND
the rentedHouseMoveInDateTr is less than or equal to today AND
the rentedHouseMoveOutDateTr is NULL
OR
the rentedHouseMoveInDateTr is less than or equal to today AND
the rentedHouseMoveOutDateTr is greater than today's date.
如果返回结果,则该属性被占用否则是空的
我正在使用的SQL语句是:
SELECT * FROM rentedHouseTbl,其中propertyIDTr ='1'AND((rentedHouseMoveInDateTr <= CURDATE()AND rentedHouseMoveOutDateTr为NULL)或(rentedHouseMoveInDateTr <= CURDATE()AND rentedHouseMoveOutDateTr> CURDATE())] >>
但是我没有得到预期的结果。任何帮助,将不胜感激!
我被困在一条SQL语句上。我正在尝试获取以下内容:从rentedHouseTbl选择字段,其中属性与propertyIDTr匹配,并且rentedHouseMoveInDateTr小于或等于...
SELECT * FROM rentedHouseTbl
where (rentedHouseMoveInDateTr <= CURDATE() AND rentedHouseMoveOutDateTr IS NULL)
OR (rentedHouseMoveInDateTr <= CURDATE() AND rentedHouseMoveOutDateTr > CURDATE())