, , , (location) ORDER BY, SELECT DISTINCT. SQL ( , , -, Enres). ( ):
( SQL):
SELECT DISTINCT
thing_id
, thing_name
FROM thing
ORDER BY thing_id
, thing_name ;
( SQL, ):
SELECT DISTINCT
thing_id
, thing_name
FROM thing
ORDER BY thing_name
, location;
? ORDER BY SELECT DISTINCT. , thing_id thing_name, location. . , . ( ), ?
SELECT DISTINCT SELECT ALL GROUP BY ( ):
SELECT ALL
thing_id
, thing_name
FROM thing
GROUP BY thing_id
, thing_name
ORDER BY thing_name
, location;
( 2) PostgreSQL, SQL-Server Oracle. SQL-Fiddle
, Ingres, , , , , location SELECT, ORDER BY . DISTINCT :
SELECT DISTINCT
thing_id
, thing_name
(, location
FROM thing
ORDER BY thing_name
, location;
, , , , .
, Actian: DISTINCT + ORDER BY . , , ( "" ).
, , , :
SELECT
RIGHT(SQUEEZE(thing_id), 2) AS squeezed_thing_id
, TRIM(thing_name) AS trimmed_thing_name
, MIN(location) AS a_location
FROM
thing
GROUP BY
RIGHT(SQUEEZE(thing_id), 2)
, TRIM(thing_name)
ORDER BY
trimmed_thing_name
, a_location ;