Hi
I have a table like this
id | park | visitors | date
1 | 1 | 20 | 1/1/2014
2 | 2 | 20 | 1/1/2014
3 | 3 | 15 | 1/1/2014
4 | 4 | 13 | 1/1/2014
5 | 5 | 45 | 1/1/2014
6 | 1 | 20 | 1/1/2014
7 | 2 | 20 | 1/1/2014
8 | 3 | 15 | 1/1/2014
9 | 4 | 13 | 1/1/2014
10 | 5 | 45 | 1/1/2014
11 | 1 | 20 | 1/2/2014
12 | 2 | 20 | 1/2/2014
13 | 3 | 15 | 1/2/2014
14 | 5 | 45 | 1/2/2014
Notice: in 1/2/2014 there are not registered visitors for Park 4
I tried to do a query to show a result like this:
park | visitors_per_day | dateCol
1 | 40 | 1/1/2014
2 | 40 | 1/1/2014
3 | 30 | 1/1/2014
4 | 26 | 1/1/2014
5 | 90 | 1/1/2014
1 | 20 | 1/2/2014
2 | 20 | 1/2/2014
3 | 15 | 1/2/2014
4 | 0 | 1/2/2014
5 | 45 | 1/2/2014
This is my query
select park, count(*) as visitors_per_day, dateCol from oneTable group by park, dateCol order by dateCol, park
Actually, my query does not show the Park 4 in 1/2/2014, see next example
park | visitors_per_day | dateCol
1 | 40 | 1/1/2014
2 | 40 | 1/1/2014
3 | 30 | 1/1/2014
4 | 26 | 1/1/2014
5 | 90 | 1/1/2014
1 | 20 | 1/2/2014
2 | 20 | 1/2/2014
3 | 15 | 1/2/2014
5 | 45 | 1/2/2014
Is it possible to show the park 4 with a zero ?
I'm using Netezza (based on postgresql 7)
PS: sorry for my bad english... it's not my mother tongue