Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-03-06 : 21:08:51
|
Alan writes "Hello Mr Guru,
A quick question about building a dynamic SQL statement for a search string - i am using an Access DB on NT Server SP6 and have performed two INNER JOINS to receive specific search results. The SQL statement builds something along the lines of -
SELECT * FROM Forums INNER JOIN (Topics INNER JOIN Posts ON Topics.TopicId = Posts.TopicId) ON Forums.ForumId = Posts.ForumId WHERE ((([Topics.Topic]) = 'slow') OR (([Topics.Topic]) = 'dynamic') AND (([Posts.ForumId])=3) AND (([Posts.PostDate]) BETWEEN #3/5/01 3:21:59 PM# AND #2/13/01 3:21:59 PM#) AND (([Posts.loginId])=2)) ORDER BY Posts.ForumId ASC
The SQL statement works fine up until the point where it gets to the OR statement, it then just ignores everything after this, if the OR statement is removed the full SQL statement executes no probs at all, the OR statement is included so the client has the option of searching on multiple words seperated by a space.
Not too sure if that clearly explains the problem but let me know what you think!
Cheers,
Alan. " |
|
|
|
|