Hi to all,


I have 3 table customers,addresses,orders

Code:
Customer table
===========

c_id      c_fname              c_email
---------------------------------------
 1           a                     a@gmail.com
 2           b                     b@gmail.com       


Addresses table
============

a_id        c_id         a_address 
---------------------------------------
1             1              xyz
2             1              xyz
3             2              abc
4             2              abc


Orders table
===========

o_id      c_id         o_total        o_date
--------------------------------------
1            1             10            2013-01-01  
2            1             20            2013-02-02  
3            1             30            2013-03-03   
4            2             40            2013-01-01

1-Get all the customer information from customers table
2-First address of each customer not the both because addresses table has shipping and buyer address which can be same so two entries will be there in address so i want only first one

3-date of first order
4-Total amount purchase
5-Amount purchased in last 30 days
6-Amount purchased in last 60 days
7-Amount purchased in last 90 days


Finale result will be
Code:
c_id  c_name    c_email               a_id    a_address   total_purchase      first_ord               last_purchase    30days_purchase    60days
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1         a           a@gmail.com        1            xyz                    60                  2013-01-01           2013-03-03             30                             50
2         b           b@gmail.com        3            abc                   40                  2013-01-01           2013-01-01             NULL                        NULL
Any help