Reputation: 53
I'm supposed to have it present me an address of a property which had people move in within a month after it was listed.
SELECT rp.rp_street, rp.rp_city, rp.rp_state, rp.rp_zipcode
FROM dbo.rentproperty rp
INNER JOIN dbo.rental r
ON (rp.rp_propertyno = r.ren_rp_propertyno)
WHERE r.ren_moveindate BETWEEN rp.rp_datelisted AND rp.rp_datelisted + 30;
I keep getting
Msg 206, Level 16, State 2, Line 1
Operand type clash: date is incompatible with int
Upvotes: 0
Views: 59
Reputation: 39457
You can use dateadd(day,n,col)
to add days to date:
select rp.rp_street, rp.rp_city, rp.rp_state, rp.rp_zipcode
from dbo.rentproperty rp
inner join dbo.rental r on (rp.rp_propertyno = r.ren_rp_propertyno)
where r.ren_moveindate between rp.rp_datelisted
and dateadd(day, 30, rp.rp_datelisted);
Upvotes: 3