5.5.1 Using the MATCHNUM Function
The MATCHNUM
function returns a number that uniquely
identifies a match in a set of matches.
The numbers are not necessarily consecutive, and gaps may appear (for
instance, when matches are filtered out). Rows returned from
GRAPH_TABLE
have unique match numbers unless ONE ROW PER
VERTEX
or ONE ROW PER STEP
is specified, in which case the
same match number is returned for different iterations within a match.
MATCHNUM
can be used only in the COLUMNS
clause of the
SQL graph query as shown.
SELECT *
FROM GRAPH_TABLE ( g
MATCH (p IS person)
COLUMNS (MATCHNUM() AS matchnum,
p.name)
)ORDER BY matchnum;
The preceding graph query matches all person vertices and for each match
returns a unique match number as well as the name of the person
.
See Example 5-19 for more information.
Parent topic: Using ONE ROW PER Clause in a SQL Graph Query