Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to search for all keywords inclusive
Message
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01357215
Message ID:
01357222
Views:
40
This message has been marked as a message which has helped to the initial question of the thread.
Here VFP 9 Version :-)
CREATE cursor MainC ;
(ID_Field I, char_Field c(250))
INSERT INTO MainC VALUES (1,'Mother Father Daughter Son')
INSERT INTO MainC VALUES (2,'Mother Daughter Son')
INSERT INTO MainC VALUES (3,'Mother Son')
INSERT INTO MainC VALUES (4,'Daughter Son')
INSERT INTO MainC VALUES (5,'Mother Father Son')
INSERT INTO MainC VALUES (6,'Son Daughter Father')
INSERT INTO MainC VALUES (7,'Mother Son')
INSERT INTO MainC VALUES (8,'Other Word')

SELECT 0
CREATE CURSOR KeyWords (Word C(20), IF I)
INSERT INTO KeyWords VALUES ('Mother',1)
INSERT INTO KeyWords VALUES ('Father',2)
INSERT INTO KeyWords VALUES ('Son',3)
INSERT INTO KeyWords VALUES ('Daughter',4)
lnCount = RECCOUNT()

SELECT M.*;
FROM MainC M ;
INNER JOIN (;
SELECT MainC.Id_Field;
                   FROM MainC ;
            INNER JOIN KeyWords K2 ON MainC.char_Field LIKE '%'+ALLTRIM(K2.Word)+'%';
            GROUP BY MainC.Id_Field;
            HAVING COUNT(*) = lnCount;
) K33;
ON M.ID_Field  = K33.ID_Field 
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform