sql server 2008 - Using case max date() does not return all parent rows -
hi following query not return projects , stores. shows store has @ least 1 status date filled.
how can projects projects table , stores stores table , show status date stores (wherever filled).
select projectname,store, max(case when activity = 'visited' date else null end) visited, max(case when activity = 'notvisited' date else null end) notvisited, max(case when activity = 'finished' date else null end) finished table1 t inner join project p on t.projectid = p.projectid inner join store s on t.storeid = s.storeid inner join activity on t.activityid = a.activityid group projectname,store
Comments
Post a Comment