All pastes #560668 Raw Edit

Miscellany

public text v1 · immutable
#560668 ·published 2007-06-12 05:01 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 set count=(select count_term b from logs_cnt where a.term=b.term);

DROP TABLE logs_cnt;


OR

update logs a set count=(select count(term) from logs b where a.term=b.term);