[!SUMMARY] Table of Contents
The value you want to obtain thorough
Group By
should groupvalue
and then sortid
but the sorting does not work
example test database table: test
ID | VALUE |
---|---|
1 | 1 |
2 | 1 |
3 | 2 |
4 | 3 |
if the data in a DB table does not have a meaningful order the
Group By
will not work Using theLIMIT
clause imposes a restriction on the number of data rows thus changing the data content to have a meaningful order
select value
from (
select *
from test
order by id desc
limit 18446744073709551615
) group by value;
value |
---|
3 |
2 |
1 |
select value
from (
select *
from test
order by id asc
) group by value;
value |
---|
1 |
2 |
3 |
select value
from (
select *
from test
order by id desc
) group by value;
value |
---|
1 |
2 |
3 |