Topic: Non-standard grouping of the data in request

Good afternoon!
Help to fulfill request about grouping of the data please:
There is a table distancetime (id, time, name), the following data is written to it:
1 3:10:00 AM Punkt1
2 3:17:00 AM Punkt1
3 3:18:00 AM Punkt1
4 3:29:00 AM Punkt2
5 3:40:00 AM Punkt3
6 3:42:00 AM Punkt3
7 3:52:00 AM Punkt1
8 3:53:00 AM Punkt1
9 3:54:00 AM Punkt4
10 5:25:00 AM Punkt5
As a result of request should it turns out:
1 3:10:00 AM Punkt1
4 3:29:00 AM Punkt2
5 3:40:00 AM Punkt3
7 3:52:00 AM Punkt1
9 3:54:00 AM Punkt4
10 5:25:00 AM Punkt5
Prompt please as the given sampling can be carried out.

Re: Non-standard grouping of the data in request

Well if you still tell, HOW from the initial data total sampling why these records are left is received, and remaining are discarded...

Re: Non-standard grouping of the data in request

Akina wrote:

Well if you still tell, HOW from the initial data total sampling why these records are left is received, and remaining are discarded...

I assume that there should be a check on entrances of Points, i.e. 1stroka-time of Punkt1, further, if the name changed an output 4stroka-time of Punkt2, then by analogy 5stroka-time of Punkt3, further a name changed 7stroka-time of Punkt1 and .
How to carry out the given check (grouping) inside Select to me it is not clear. Therefore also I ask helps
If to carry out sampling on unique entrances repeating entrances on Points, through various time intervals disappear

Re: Non-standard grouping of the data in request

``````SELECT id, ` time `, name
FROM (SELECT (name! = @prev) ok, (@prev: = name) name, id, ` time`
FROM distancetime, (SELECT @prev: = ") x
ORDER BY ` time`
) xx
WHERE ok;``````

Re: Non-standard grouping of the data in request

Akina wrote:

``````SELECT id, ` time `, name
FROM (SELECT (name! = @prev) ok, (@prev: = name) name, id, ` time`
FROM distancetime, (SELECT @prev: = ") x
ORDER BY ` time`
) xx
WHERE ok;``````

Thanks big! I will know now!