Summary table queries and various fixes when no data exist
summary table