-
+
+
\crosstabview [
colV
- colH
- [:scolH ]
+ colH [:scolH ]
[colD ]
]
- Execute the current query buffer (like \g ) and shows
- the results inside a crosstab grid.
+ Executes the current query buffer (like \g ) and
+ shows the results in a crosstab grid.
The query must return at least three columns.
- The output column colV >
- becomes a vertical header
- and the output column colH
+ The output column identified by colV >
+ becomes a vertical header and the output column identified by
+ colH
becomes a horizontal header, optionally sorted by ranking data obtained
- from scolH .
- colD
- is the output column to project into the grid. If this is not
+ from column scolH .
+ colD identifies
+ the output column to display within the grid.
+ If colD is not
specified and there are exactly three columns in the result set,
- the column that isn't
+ the column that is neither
colV nor
colH
- is displayed; if there are more columns, an error is thrown .
+ is displayed; if there are more columns, an error is reported .
- All columns can be refered to by their position (starting at 1), or by
- their name. Normal case folding and quoting rules apply on column
- names. By default,
- colV corresponds to column 1
- and colH to column 2.
- A query having only one output column cannot be viewed in crosstab, and
+ Each column specification can be a column number (starting at 1) or
+ a column name. The usual SQL case folding and quoting rules apply to
+ column names. If omitted,
+ colV is taken as column 1
+ and colH as column 2.
colH must differ from
colV .
- The vertical header, displayed as the leftmost column,
- contains the deduplicated values found in
- column colV , in the same
- order as in the query results.
+ The vertical header, displayed as the leftmost column, contains the
+ values found in column colV>, in the
+ same order as in the query results, but with duplicates removed.
- The horizontal header, displayed as the first row,
- contains the deduplicated values found in
- column colH , in
- the order of appearance in the query results.
- If specified, the optional scolH
- argument refers to a column whose values should be integer numbers
- by which colH will be sorted
- to be positioned in the horizontal header.
+ The horizontal header, displayed as the first row, contains the values
+ found in column colH ,
+ with duplicates removed. By default, these appear in the same order
+ as in the query results. But if the
+ optional scolH> argument is given, it
+ identifies a column whose values must be integer numbers, and the
+ values from colH will
+ appear in the horizontal header sorted according to the
+ corresponding scolH> values.
- Inside the crosstab grid,
- given a query output with N columns
- (including colV and
- colH ),
- for each distinct value x of
- colH
- and each distinct value y of
- colV ,
- the contents of a cell located at the intersection
- (x,y) is determined by these rules:
-
-
- if there is no corresponding row in the query results such that the
- value for colH
- is x and the value
- for colV
- is y , the cell is empty.
-
-
-
-
- if there is exactly one row such that the value
- for colH
- is x and the value
- for colV
- is y , then the colD column
- is displayed.
+ Inside the crosstab grid, for each distinct value x
+ of colH and each distinct
+ value y
+ of colV , the cell located
+ at the intersection (x,y) contains the value of
+ the colD column in the query result row for which
+ the value of colH
+ is x and the value
+ of colV
+ is y>. If there is no such row, the cell is empty. If
+ there are multiple such rows, an error is reported.
-
-
- if there are several such rows, an error is thrown.
-
-
-
-
-
-
-
+
\d[S+] [ pattern ]