Gossamer Forum
Home : General : Databases and SQL :

SQL for search

Quote Reply
SQL for search
Just sit here and try to program the search for LSQL in php;
to find just one word i will do:

select word_id from word_list,
select item_id from score_list where word_id=word_id from word_list order by score DESC

(in one query :)

But i have no clue how to make sorting the query for two words

select where word_id = 1 or word_id = 2

The sort should be again score, but for every item_id with both words i should add the score.

Maybe query for:
1. where word 1 and word 2
2. where word1 or word 2


Then i limit everytime to 10, so i have maybe 20, put them in an array, make the sum of score, sort the array, spit out 10?
Subject Author Views Date
Thread SQL for search Robert 5219 Dec 31, 2007, 8:17 AM
Thread Re: [Robert] SQL for search
Robert 4991 Dec 31, 2007, 9:23 AM
Post Re: [Robert] SQL for search
Robert 4954 Dec 31, 2007, 11:06 AM