Help!
I am trying to write an SQL statement (without much luck) to extract
the total number of searches and orders from a particular customer,
grouped into days/months/weeks (depending on the report type.
The tables are as follows:
Searches
--------------
search_id (PKEY)
customer_id (FKEY)
product_id
cost
date
.....
Orders
-----------
order_id (PKEY)
search_id (FKEY)
order_value
date
....
Groups
-----------
group_id (PKEY)
customer_id
....
Customers
---------------
customer_id (PKEY)
.....
What I want to achieve from this is
For all customers with Group_id = '17'
Mth 1 1244(Searches) 846(Orders)
Mth 2 2345(Searches) 1834(Orders)
Mth 3 2342(Searches) 1954(Orders)
Mth 4 2425(Searches) 2134(Orders)
Mth 5 5235(Searches) 4253(Orders)
I am clearly nowhere near the level I need to be to achieve this.
Can it be achieved in a single statement?
Thanks
I am trying to write an SQL statement (without much luck) to extract
the total number of searches and orders from a particular customer,
grouped into days/months/weeks (depending on the report type.
The tables are as follows:
Searches
--------------
search_id (PKEY)
customer_id (FKEY)
product_id
cost
date
.....
Orders
-----------
order_id (PKEY)
search_id (FKEY)
order_value
date
....
Groups
-----------
group_id (PKEY)
customer_id
....
Customers
---------------
customer_id (PKEY)
.....
What I want to achieve from this is
For all customers with Group_id = '17'
Mth 1 1244(Searches) 846(Orders)
Mth 2 2345(Searches) 1834(Orders)
Mth 3 2342(Searches) 1954(Orders)
Mth 4 2425(Searches) 2134(Orders)
Mth 5 5235(Searches) 4253(Orders)
I am clearly nowhere near the level I need to be to achieve this.
Can it be achieved in a single statement?
Thanks
Comment