· 8 years ago · Aug 30, 2018, 05:28 AM
1Will a LEFT JOIN View with GROUP BY inside of it do the right thing?
2CREATE TABLE IF NOT EXISTS user.Log (
3 term TEXT,
4 seen DATETIME
5);
6CREATE INDEX IF NOT EXISTS user.Log_term ON Log(term);
7CREATE VIEW IF NOT EXISTS user.History AS
8SELECT term, COUNT(1) as timesseen, MAX(seen) as lastseen
9FROM user.Log GROUP BY term;
10
11INNER JOIN History h ON h.term = t.term