All pastes #560658 Raw Edit

Miscellany

public text v1 · immutable
#560658 ·published 2007-06-12 04:55 UTC
rendered paste body
CREATE TABLE logs_cnt
SELECT *, 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)
ON a.count = b.count_term;

DROP TABLE logs_cnt;