I’m wanting to know if it is possible to convert this code below, so that it only needs 1 query instead of allot more query’s? the items table is filled with well over 10k items, and the below way, just takes so long, is there a faster way of displaying the uncategorised item?
$CD1=mysql_query("select * FROM items");
while($C1=mysql_fetch_array($CD1)){
$sql=mysql_query("select * from category where sub='$C1[sub]'");
if(mysql_num_rows($sql) == 0)
echo "$C1[id]->$C1[sub]<br>";
}
You should use outer join and where clause to filter items with no categories