I have a table "items" and a table "itemkeywords". When a user searches for a keyword, I want to give him one page of results and the total number of results.
What I am currently doing (for a user who is looking for "ab c":
SELECT DISTINCT {fields I want} FROM itemkeywords JOIN items
WHERE (keyword = 'a' or keyword='b' or keyword='c'
ORDER BY "my magic criteria"
LIMIT 20.10
and then I make the same query with the count
SELECT COUNT(*) FROM itemkeywords JOIN items
WHERE (keyword = 'a' or keyword='b' or keyword='c'
This can lead to the fact that you get a rather large table, and I believe that this solution is very suck ...
But I can not come up with anything better.
, MySQL, LIMIT, , , , ...
?
. ASP.Net MySQL, PHP