alias<T, D> method

T alias<T, D>(
  1. ResultSetImplementation<T, D> table,
  2. String alias
)

Creates a copy of the table with an alias so that it can be used in the same query more than once.

Example which uses the same table (here: points) more than once to differentiate between the start and end point of a route:

var source = alias(points, 'source');
var destination = alias(points, 'dest');

select(routes).join([
  innerJoin(source, routes.startPoint.equalsExp(source.id)),
  innerJoin(destination, routes.startPoint.equalsExp(destination.id)),
]);

Implementation

T alias<T, D>(ResultSetImplementation<T, D> table, String alias) {
  return table.createAlias(alias).asDslTable;
}