I have to count if UserId is listed one or more times and if one put +1 to "new users" else "+1" to "returning users".
Have I have done:
select
Count(distinct [UserId]) as 'Unique users'
from [TelemetryData]
where [DiscountId] = '8CAEA860-6766-43E2-9280-27AFE7FDF82E' and [EventName] = 'DiscountClick'
/* returning */
select
count(Id) as 'Returning users'
from [TelemetryData]
where [DiscountId] = '8CAEA860-6766-43E2-9280-27AFE7FDF82E' and [EventName] = 'DiscountClick'
group by [UserId]
having count(Id) > 1
/* returning */
select
count(*) as 'New users'
from [TelemetryData]
where [DiscountId] = '8CAEA860-6766-43E2-9280-27AFE7FDF82E' and [EventName] = 'DiscountClick'
group by [UserId]
having count(*) = 1
I need count total numer of rows in "returning" and "new" users query like in first query. How to do it?