Skip to content

Tag: distinct

Select Last Rows with Distinct Field

I have a table with the following schema: In this table only the id field is unique. I’m concerned with getting the rows containing the last X distinct itemid, ordered by date. For example, in the sample above, if I’d like to get the last 3 distinct itemid, I’d be getting the first 4 rows, s…

Finding daily registered users

I have a table which includes the information of player_id, first_timestamp, last_timestamp, and date, etc. So I have initially 10 payers on 2020-07-08, and then 18 players on 2020-07-09, some of the players from previous day might appear on 2020-07-09 again. And I’m trying to find the new players regis…