When I call this line: select datetime(date, 'unixepoch', 'localtime') as "date", case when flags=3 then 'sent' else 'received' end as "from",...
Separate names with a comma.