Home > Back-end >  How SQL queries to the largest contiguous data?
How SQL queries to the largest contiguous data?

Time:10-31

Unqualified AutoId order number time
1 A, 1 2014-11-1
2 B 0, 2014-11-2
3 A 1 2014-11-3
4 A 1 2014-11-4
5 A 0, 2014-11-5
6 B 1 2014-11-6


The statistical data of the same order for the maximum number of qualified, the results are as follows:

Unqualified number order number time
3 A 1 2014-11-3
4 A 1 2014-11-3
5 A 1 2014-11-4
6 B 1 2014-11-6

CodePudding user response:

Said the database type, complex SQL support degree is not the same

CodePudding user response:

Ordinary Delphi + MySQL

CodePudding user response:

Don't know how your number 5 data, ranking function can try

CodePudding user response:

This kind of meaning, difficult ah!

CodePudding user response:

reference salted fish love turn reply: 3/f
don't know how your number 5 data, can try to rank function


Is I write there should be no wrong number 5, 5 is not qualified, A only two consecutive,
Unqualified number order number time
3 A 1 2014-11-3
4 A 1 2014-11-4
6 B 1, 2014-11-6

CodePudding user response:

Won't feel pure SQL implementation because RDBMS is the mathematical basis of filtering and projection operations, with no requirement for the order of the record in a table, and the problem that the building Lord relies heavily on record, the relative position of the connection between such as change of sorting conditions will produce different results, so the problem of the building Lord can only use the program (also can use stored procedures) scan data sets,
  • Related