bot or not bot: UPDATE mit Subselect oder GROUP BY oder ...

Beitrag lesen

Ich habe das Problem gelöst:

CREATE TEMPORARY TABLE tmp\_counter
SELECT *
FROM (
SELECT counter.id , IF(MIN(bots.bot),1,0) AS bot
FROM counter
LEFT JOIN counter\_bots AS bots ON counter.HTTP\_USER\_AGENT
REGEXP bots.regex
GROUP BY counter.id
) AS data;
UPDATE counter JOIN tmp\_counter ON tmp\_counter.id = counter.id
SET counter.bot = tmp\_counter.bot;
SELECT * FROM counter

bot or not bot