able1: user_info = user_id, user_scubscription_type(trial/paid) table1 user_id = primary key table2 user_id = foreign key objective: To identify the 3rd highest feature is being used by trial users
table2: feature_usage = feature_id, user_id,
Apart from using limit what's the other way of writing query
I think we can even use row number function rt
Can anyone help me with the query
Rajanikant HawaldarPosted Sep 23, 2022, 12:40 PM
Hello Amit,
If you start with...
That starts by giving you the most common features by user. But it FAILS to give you what you want. Because the numbers should all be 1!
Then you reailze what you want is:
basically SUM up the features used by trial users.
Very important when dealing with sets is getting it straight in your head. Are you getting users or data for a set of users.
The second query gives you data (count of each feature) for a set of TRIAL users.
After this is working, you can add a WINDOWING function to get the "#". Using limits only after the data is sorted.