mysql - How to count new users in last month in SQL? -


enter image description here

i want know how many new users have last month, , how many of them have turned buyers while can not figure out smoothly.the following coded.

select count(distinct(product_id))  order_table o   inner join customer_table c    on o.customer_id=c.customer_id datediff(month,order_date,getdate())<=1 

and there question has confused me lot: category have highest year year growth in terms of revenue in 2016?

this should it...

select count(customer_id) customer_table customer_id in (         select customer_id         order_table         )     , datediff(month, first_visit, getdate()) <= 1 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -