How to Extract new paid subscribers and upgrade subscribers in a single MySQL query from the provided data?

[image
How to get the above result]

Welcome, please provide sample data with Table structure?

You provided a picture of the result you want - which is okay. But we have no idea what the source of the data looks like so cannot provide any recommendations.

If you can provide sample data in the form of a create table statement and insert statements that generate a temp table and the rules to be applied to that data to get to the results we can provide a workable query.


here is the schema

''docs_google_com/spreadsheets/d/1rnnGDDMCBhwUzigcY7LbcNR1_jxRlQW6aKA1kXNA0gs/edit#gid=4272436''

please visit this link for the data with the tables and instructions by changing '_' into '.'

Most people on this forum - including me - won't click on links or navigate to unknown/unconfirmed web sites due to security risks.

Please post the create/insert statements here - then we can copy/paste that into SSMS on our systems. That way we can generate a tested/validated solution.

2 Likes

sample way of providing data for us to help you since we do not have access to your database. providing sample data as below emulates your data in our sql server.

--schema
declare @learner(id int, name varchar(50))
--data
insert into @leaner
select 1, 'Vader' union
select 2, 'Luk'

etc etc

1 Like