If you want to remove the join you could change it to a sub query although if it’s faster or not depends on a lot of factors, the main benefit is it filters out a lot of the data removing much of the overhead but you’d have to run benchmarks to determine if it’s faster in this case.
Example:
PHP Code:
SELECT COUNT(*) FROM torrents WHERE category IN (SELECT id FROM categories $where)
This is just off the cuff so might not work straight out the box I’ve not used torrent trader in a few years.