I have two simple table setup:

```
table: deals
dealID   |   dealDate    | storeName
1        |   2013-04-01  | bayport
2        |   2013-04-01  | staten island
3        |   2013-04-04  | bayport

table: phoneDetails
phoneID    |   dealID    | dateReceived
1          |   1         | 2013-04-04
2          |   1         | 2013-04-04
3          |   2         | 2013-04-06
4          |   3         | 2013-04-05
5          |   3         | 2013-04-05

```

So based on this table, I need to query my db to show the dealDate and how many phones were received on that date per store OR even using calendar dates instead of dealDate will work too. For example:

```
dealDate    |  storeName     | Received
2013-04-01  |  bayport       | 0
2013-04-01  |  staten island | 0
2013-04-04  |  bayport       | 2

```

Any help would be appreciated. I know how to query the dealDate and storeName but I am confused on how to subquery the 'Received' count since the dealDate and the dateReceived are different.

@echo\_me, what do I do to change the result to look like this instead which is based on the calendar instead of the dealDate. See how I received 1 phone on April 6 even though there was no deal done on that date

```
date       |  storeName      |  received
2013-04-01 |                 |  0
2013-04-02 |         |                          
2013-04-03 |                 |
2013-04-04 | bayport         |  2
2013-04-05 | bayport         |  1
2013-04-06 | staten island   |  1 

```