Hi
I'd really appreciate if someone could help me with this query.
I have three tables
---items---
| id
------------
| name
| desc
| catId
------------
---cats----
| id
|----------
| name
| desc
------------
--itemToks--
| itemId
| tok
|-------------
--------------
cats is just the category each item falls under.
itemToks is defined search strings which relate to each item. The point of which is to allow the user to search for items using various characteristics.
----------
I would like to be able to search for complete match(es) of itemToks.tok using more than one search term (where itemToks.tok IN ('tok1', 'tok2') ?) and return each category and the number of instances of matches.
So far I have this which works but isn't a search and returns all categories :
select cats.id as id, cats.name as name, count(items.cat) as count from cats left outer join items on items.cat = cats.id group by items.cat
Hopefully i've explained this ok, please let me know if otherwise. Help would be very much appreciated as I've wasted too much time on this already.
I'd really appreciate if someone could help me with this query.
I have three tables
---items---
| id
------------
| name
| desc
| catId
------------
---cats----
| id
|----------
| name
| desc
------------
--itemToks--
| itemId
| tok
|-------------
--------------
cats is just the category each item falls under.
itemToks is defined search strings which relate to each item. The point of which is to allow the user to search for items using various characteristics.
----------
I would like to be able to search for complete match(es) of itemToks.tok using more than one search term (where itemToks.tok IN ('tok1', 'tok2') ?) and return each category and the number of instances of matches.
So far I have this which works but isn't a search and returns all categories :
select cats.id as id, cats.name as name, count(items.cat) as count from cats left outer join items on items.cat = cats.id group by items.cat
Hopefully i've explained this ok, please let me know if otherwise. Help would be very much appreciated as I've wasted too much time on this already.
