Window
Definition
The window method allows you to add the WINDOW clause to the query.
The WINDOW clause allows you to define multiples window definition that can be referenced in OVER clause.
Available methods
1. window(KWindowDefinitionAllowedToWindow... KWindowDefinitionsAllowedToWindow)
- KWindowDefinitionsAllowedToWindow: are all the window definitions which will be supplied to the
WINDOWclause.
Method hierarchy
The window method can be used right after the following methods:
selectDistinct,select1,select,from,innerJoin,leftJoin,rightJoin,fullJoin,crossJoin,where,groupBy,having,window
and the subsequent methods that can be called are:
window,except,exceptAll,intersect,intersectAll,union,unionAll,orderBy,limit,offset,fetch,single,multiple
Example
Java code:
final KWindowDefinitionUnnamedPartitioned wdn1 =
wd("the_name")
.partitionBy(APP_USER.ROLE_ID);
k
.select(
APP_USER.FIRST_NAME,
rowNumber().over(wdn1)
)
.from(APP_USER)
.window(wdn1)
.multiple();
SQL generated:
SELECT
au.first_name,
ROW_NUMBER() OVER "the_name"
FROM app_user au
WINDOW "the_name" AS (PARTITION BY au.role_id)
Parameters:
- None