Reputation: 185
What I'm trying to do:
SELECT MAX(index), scr FROM history WHERE state = "TQA" GROUP BY scr
So, for every 'scr' in the table, I want a row showing the maximum index where the 'state' of that row = 'TQA'. For some reason this gives me a syntax error near "index".
Upvotes: 0
Views: 330
Reputation: 180917
INDEX
is a reserved keyword in SQLite. If you want to use that as a field name, you'll need to quote it;
SELECT MAX("index"), scr FROM history WHERE state = "TQA" GROUP BY scr
Upvotes: 1