-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQLTEST.sql
More file actions
51 lines (38 loc) · 728 Bytes
/
Copy pathSQLTEST.sql
File metadata and controls
51 lines (38 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
SELECT
ff.PremisesId
,isNull(p.StreetNo,'') as StreetNo
,IsNull(p.[Street],'') AS Street
,ISNULL(b.Business,'') AS Business
,SUM(isnull(ff.[Count],0)) as [Count]
FROM
dbo.Footfall (NOLOCK) ff
INNER JOIN
dbo.[Premises] (NOLOCK) p
ON
ff.[PremisesId] = p.[Id]
INNER JOIN
dbo.[Businesses] b (NOLOCK)
ON
p.[BusinessId] = b.Id
GROUP BY
ff.[PremisesId],
p.[StreetNo],
p.[Street],
b.[Business]
ORDER BY
ff.PremisesId
--INNER JOIN
-- dbo.Premises (NOLOCK) p
-- ON
-- ff.Premisesld = p.Id
--INNER JOIN
-- dbo.[Businesses] b (NOLOCK)
-- ON
-- p.BusinessId = b.Id
--Group By
-- ff.[Premisesld],
-- b.[Business],
-- ff.[Count],
-- p.[StreetNo],
-- p.[Street],
-- p.[PostCode]