Jump to content

How can I reduce this query and use a 1 column tagging system.


netstormx

Recommended Posts

So I have around 8 columns that have tags for categories. Is there a way I could merge all of these into one column, then just parse by commas though php? Heres what I have now.

 

$query  = "SELECT COUNT(ratings.id) as rates,ratings.rating_id,games.gameid as gameid,gametitle as gametitle,gameimage as gameimage,gametitle as gametitle,ROUND(AVG(ratings.rating_num),2) as rating FROM ratings,games WHERE games.gameid = ratings.rating_id AND caturl='$location' OR games.gameid = ratings.rating_id AND tags1='$location' OR games.gameid = ratings.rating_id AND tags2='$location' OR games.gameid = ratings.rating_id AND tags3='$location' OR games.gameid = ratings.rating_id AND tags4='$location' OR games.gameid = ratings.rating_id AND tags5='$location' OR games.gameid = ratings.rating_id AND tags6='$location' OR games.gameid = ratings.rating_id AND tags7='$location' OR games.gameid = ratings.rating_id AND tags8='$location' OR games.gameid = ratings.rating_id AND tags9='$location' GROUP BY rating_id ORDER BY rating DESC LIMIT $offset, $rowsPerPage";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.