joining two tables and getting aggregate data

Posted by alex on Stack Overflow See other posts from Stack Overflow or by alex
Published on 2010-04-16T20:17:07Z Indexed on 2010/04/16 20:23 UTC
Read the original article Hit count: 144

Filed under:
|

how do i write a query that returns aggregate sales data for California in the past x months.

 -----------------------        -----------------------
|         order         |      |       customer        |
|-----------------------|      |-----------------------|
| orderId       int     |      | customerId     int    |
| customerId    int     |      | state         varchar |
| deposit       decimal |       -----------------------
| orderDate     date    |   
 ----------------------- 


                  ----------------------- 
                 |      orderItem        |
                 |-----------------------|
                 | orderId      int      |
                 | itemId       int      |
                 | qty          int      |
                 | lineTotal    decimal  |
                 | itemPrice    decimal  |
                  ----------------------- 

© Stack Overflow or respective owner

Related posts about sql

Related posts about homework