Skip to content
Advertisement

SQL : get number of user but order date [closed]

I trying to get how many user i got in a precise day compared to the first order for exemple :

I did an sql query like that :

but with this query i have something like this exemple:

so i tried to group by u.id and DATE_FORMAT(FROM_UNIXTIME(o.order_created),'%Y-%m') like this exemple :

but it still does not work and in the 2 case, the result of the ‘userCount’ is not good.

So my question is, how can i get a number of users in grouped in specific month?

Advertisement

Answer

I think you are asking for a pretty simple aggregation:

I’m a bit baffled why you are joining order_products when that table is not being used. And the join conditions also don’t make sense.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement