Home > database >  Available for a group group ~ ~ of the SQL statement
Available for a group group ~ ~ of the SQL statement

Time:09-28


Like this, first by name group (database personId fields), and then sort by time (timestamp) in the group, and then according to each person's latest record time for the whole set of sorting,
Could you tell me how to write SQL that each master ah, I really can't figure out ~
PS: don't tube diagram form time, artists literally written,

CodePudding user response:



 

Select * from (
Select *, row_number () over (partition by personId order by timestamp desc) as rids the from tableName
) a
The order by rids, timestamp desc

CodePudding user response:

reference 1/f, illiterate old gu response:
 

Select * from (
Select *, row_number () over (partition by personId order by timestamp desc) as rids the from tableName
) a
The order by rids, timestamp desc

I thought the SQlite statements and SQL is essentially the same, there is no partition by SQlite result, the SQL I know it won't ~ warrior SQlite statement how to write

CodePudding user response:

Sqlite 3.25 also supports analysis function, no words can write their own, query is make a sort of columns

CodePudding user response:

reference sxq129601 reply: 3/f
3.25 also supports sqlite analysis function, no words can write their own, query is make a sorted list

Write their own simple, is feeling efficiency is much less than the database query ~

CodePudding user response:

reference 4 floor qq_15197419 response:
Quote: reference sxq129601 reply: 3/f

Sqlite 3.25 also supports analysis function, no words can write their own, query is make a sorted list

Write their own simple, is the feeling of efficiency is much less than the database query ~

Paging, their own written words, to get all the data every time, and then, one by one to their own paging, efficiency is too low
  • Related