October 2002
Intermediate to advanced
1024 pages
27h 26m
English
You want to sort a set of values using one or more substrings of each value.
Extract the hunks you want and sort them separately.
This is an application of sorting by expression value (Recipe 6.4). If you want to sort records using just a
particular portion of a column’s values, extract the
substring you need and use it in the ORDER
BY clause. This is easiest if the substrings are
at a fixed position and length within the column. For substrings of
variable position or length, you may still be able to use them for
sorting if there is some reliable way to identify them. The next
several recipes show how to use substring-extraction to produce
specialized sort orders.