I would like your help for a Oracle sql construction.
Let's say I have below database tables and descriptions: Store: store the information related to all new customers country allows to take two values: “Argentina” / “Brasil”
CustomerBOM: stores historical clientes Date: First date of each month (1/01/2017, 1/02/2017…) Client: a customer who's subscription is up to date.
Now I have to answer this question: Which is the quantity for each month?
The code I've made so far is shown below:
select date,
from CustomerBOM t1, Store t2
where t1.ID = t2.ID
group by date
having
order by date asc
Can you please guide me on how to have a full list with the difference between each month?
Edit: This is how it should look like the output of the sentence:
Month Difference
January 100 (total clients)
February 20 (120 clients from February - 100 clients from January)
March 60 (180 clients from March - 120 clients from February)
Thanks, Nicolás.
Try this:
select to_char(t1.date, 'YYYY/MM/DD') customer_month, count(1) number_of_customers
from CustomerBOM t1,
Store t2
where t1.ID = t2.ID
group by to_char(t1.date, 'YYYY/MM/DD')
order by to_char(t1.date, 'YYYY/MM/DD')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.