Reputation: 493
I've poached a bit of example code from a site explaining how to do a simple text search. However, the example SQL statement isn't valid for my version (SQL Server 2008), so I was wondering if someone could help clarify what it should look like.
Here is the example pseudocode:
SELECT t1.id
FROM
mytable t1, ..., mytable tN
ON
t2.id = t1.id AND ... AND tN.id = t1.id
WHERE
t1.text LIKE 'q1;%' AND ... AND tN.text LIKE 'qN;%'
Now I know there should be some joins in there but I can't seem to get the correct syntax.
You will probably need to look at the site for reference as to what is being done, so that is here:
http://www.alexandria.ucsb.edu/archive/2003/sql-text-search.html
It's the "contains-all-words" query example from about a third of the way down.
If someone can help with this I'll be very grateful as it seems to suit my needs exactly.
Upvotes: 1
Views: 104
Reputation: 17639
SELECT t1.id
FROM
mytable1 t1
--SPECIFY JOINs HERE
inner join myTable2 t2 ON t1.id = t2.id
inner join myTable3 t3 ON t1.id = t3.id
--etc
WHERE
t1.text LIKE 'q1;%' AND ... AND tN.text LIKE 'qN;%'
Upvotes: 1