Support for SQL + views of summary data

Fix view definition