SELECT TOP 5 Notices.Id, NoticeL.Notices_Id, Loc.Id as Location_Id,
CAST(Notices.Text AS TEXT) as Text, CAST(Notices.Title AS TEXT) as Title,
Notices.CDate as RegDate
FROM NoticeL JOIN Notices ON NoticeL.Notices_Id=Notices.Id
JOIN Loc ON NoticeL.Loc_Id=Loc.Id
WHERE Loc_Id IN (1) BETWEEN '06/04/2012' AND '23/04/2012'
I am trying to use between following IN, but I am having no luck. I am getting the following syntax error:
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'BETWEEN'.
I guess MsSql does not like the syntax. How can I do this?
Second question, I would like to filter the notices out by the last 2 weeks. Is there anyway I can do this dynamically in mssql. Thanks for your help.