0

I'm trying to query between two dates using WinSQL where I add a number of days to a field. I can't find the function to do it. I think it should be dateadd but that function does not seem to work in WinSQL.

select * from table where a.date1 >=b.date2 and a.date1 <=dateadd(dd,89,b.date2)

or

select * from table where a.date1 >=b.date2 and a.date1 <=date2+89

select * from table where a.date1 >=b.date2 and a.date1 <=dateadd(dd,89,b.date2)

or

select * from table where a.date1 >=b.date2 and a.date1 <=date2+89

I get an error with both

Dtunn
  • 1
  • What database are you using? What error are you getting? – Alejandro Mar 30 '22 at 17:54
  • I think it is an oracle database but I have to access it with WINSQL. When I do date2+89 I get the error: General error;266 inconsistent datatype: the expression has incomputable datatype: DATE is invalid for addition operator: line 18 col 73 (at pos 804) When I try to use dateadd I get the following. General error;266 inconsistent datatype: the expression has incomputable datatype: DATE is invalid for addition operator: line 18 col 73 (at pos 804) – Dtunn Mar 30 '22 at 18:35
  • Does this answer your question? [Add days Oracle SQL](https://stackoverflow.com/questions/27451226/add-days-oracle-sql) – Alejandro Mar 30 '22 at 18:59

0 Answers0