All pastes #560714 Raw Edit

Miscellany

public text v1 · immutable
#560714 ·published 2007-06-12 05:42 UTC
rendered paste body
CREATE TABLE logs_cnt
SELECT term,COUNT(term) AS count_term FROM logs GROUP BY term;

ALTER TABLE logs_cnt ADD PRIMARY KEY(term);

update logs a Inner join logs_cnt b using (term)
set a.count=count_term;

DROP TABLE logs_cnt;