Copying to tmp table SELECT tagthread.tagid, tag.tagtext, COUNT(*) AS searchcount\n\t\t\t\t\tFROM tagthread AS tagthread