The Java EE 5 Tutorial

Comparison Operators

FROM Player p1, Player p2
WHERE p1.salary > p2.salary AND = :name

Data retrieved: All players whose salaries are higher than the salary of the player with the specified name.

Description: The FROM clause declares two identification variables (p1 and p2) of the same type (Player). Two identification variables are needed because the WHERE clause compares the salary of one player (p2) with that of the other players (p1).

See also: Identification Variables