{"Entry":{"collection":"psql","key":"cmd-63-72-6f-73-73-74-61-62-76-69-65-77","name":"\\crosstabview","aliases":["\\crosstabview"],"metadata":{"aliases":["\\crosstabview"],"category":"Output and formatting","content_hash":"79d67420a0714ca73d8f298e7671a6245b3192eb97015e0f92a1a2c17bc5fb6b","derived_content_hash":"daa75f2a42693dcbacd164e7c6c846908ab6cd1dfe2627da957a9288785f2158","documentation_refresh":{"batch":"20261113","original_source_rev":"","versions":{"14":"14.25","15":"15.20","16":"16.16","17":"17.12","18":"18.7","19":"19rc2"}},"imported_at":"2026-09-30T00:40:44.744557+08:00","name":"\\crosstabview","name_zh":"","slug":"cmd-63-72-6f-73-73-74-61-62-76-69-65-77","summary":"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 identified by colV becomes a vertical header and the output column identified by colH becomes a horizontal header. colD identifies the output column to display within the grid. sortcolH identifies an optional sort column for the horizontal header."}},"Definition":{"Collection":"psql","Key":"cmd-63-72-6f-73-73-74-61-62-76-69-65-77","SourceDatabase":"center","Version":"18","SourceTable":"psql_command","SourceKey":"cmd-63-72-6f-73-73-74-61-62-76-69-65-77","SourceRevision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","Facts":{"command":"\\crosstabview","comparison_data":{"definition":"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 identified by colV becomes a vertical header and the output column identified by colH becomes a horizontal header. colD identifies the output column to display within the grid. sortcolH identifies an optional sort column for the horizontal header. 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 . If colD is not specified, then there must be exactly three columns in the query result, and the column that is neither colV nor colH is taken to be colD . 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 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 sortcolH 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 sortcolH values. 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.","modifiers":[],"signature":"\\crosstabview [ colV [ colH [ colD [ sortcolH ] ] ] ]","spellings":["\\crosstabview"]},"comparison_hash":"abf12a81cd555025f4fc46d4903e789a1cd12690887288a72af1c4eec8aefa6b","description":["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 identified by colV becomes a vertical header and the output column identified by colH becomes a horizontal header. colD identifies the output column to display within the grid. sortcolH identifies an optional sort column for the horizontal header."],"description_zh":"执行当前查询缓冲区（与 \\g 类似），并以交叉表网格显示结果。查询必须返回至少三列。由 colV 标识的输出列成为纵向表头，由 colH 标识的输出列成为横向表头。 colD 标识要在网格中显示的输出列。 sortcolH 标识横向表头的可选排序列。","description_zh_html":"\u003cdd\u003e\u003cp\u003e\n        执行当前查询缓冲区（与\u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e 类似），并以交叉表网格显示结果。查询必须返回至少三列。由 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e 标识的输出列成为纵向表头，由 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e 标识的输出列成为横向表头。\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e 标识要在网格中显示的输出列。\u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e 标识横向表头的可选排序列。\n       \u003c/p\u003e\u003cp\u003e\n        每个列指定都可以是列号（从 1 开始）或列名。通常的 SQL 大小写折叠和加引号规则适用于列名。如果省略，\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e 取第 1 列，\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e 取第 2 列。\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e 必须不同于 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e。如果未指定 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e，查询结果必须恰好有三列，既不是 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e 也不是 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e 的那一列被用作 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        纵向表头显示为最左列，包含 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e 列中的值，其顺序与查询结果中相同，但会移除重复值。\n       \u003c/p\u003e\u003cp\u003e\n        横向表头显示为第一行，包含 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e 列中的值，并移除重复值。默认情况下，它们按查询结果中的相同顺序显示。但如果给出了可选的 \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e 参数，它所标识的列的值必须是整数，而 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e 中的值会按照对应的 \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e 值排序后显示在横向表头中。\n       \u003c/p\u003e\u003cp\u003e\n        在交叉表网格中，对于 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e 中的每个不同值 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e 和 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e 中的每个不同值 \u003ccode class=\"literal\"\u003ey\u003c/code\u003e，交点\u003ccode class=\"literal\"\u003e(x,y)\u003c/code\u003e 处的单元格包含查询结果中 \u003ccode class=\"literal\"\u003ecolD\u003c/code\u003e 列的值，该结果行的 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e 值为 \u003ccode class=\"literal\"\u003ex\u003c/code\u003e，\u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e 值为 \u003ccode class=\"literal\"\u003ey\u003c/code\u003e。如果没有这样的行，单元格为空。如果存在多条这样的行，则报错。\n       \u003c/p\u003e\u003c/dd\u003e","documentation_revision":{"inputs":[{"file":"app-psql.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"af50448485df02bdef2b72b8347192ba029c7082b8d0392ecb17db44ad533aaf","version":"18.7"},{"file":"app-psql.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"cb475c53a16d9e06358f5e6c9c5649645db92568cfd319f230c62c9f57ae090b","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"},"facts":[{"label":"Client","value":"psql 18.7"},{"label":"Case-sensitive spelling","value":"\\crosstabview"}],"facts_zh":[{"label":"客户端","value":"psql 18.7"},{"label":"区分大小写的写法","value":"\\crosstabview"}],"localization":{"documentation_release":"18.7","language":"en","source_language":"en","source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552","status":"same-version-reviewed-manual"},"manual_html":"\u003cdiv\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-META-COMMANDS-CROSSTABVIEW\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\crosstabview [\n            \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e\n            ] ] ] ] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Executes the current query buffer (like \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e) and\n        shows the results in a crosstab grid.\n        The query must return at least three columns.\n        The output column identified by \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e\n        becomes a vertical header and the output column identified by\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n        becomes a horizontal header.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e identifies\n        the output column to display within the grid.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e identifies\n        an optional sort column for the horizontal header.\n        \u003c/p\u003e\u003cp\u003e\n        Each column specification can be a column number (starting at 1) or\n        a column name.  The usual SQL case folding and quoting rules apply to\n        column names.  If omitted,\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e is taken as column 1\n        and \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e as column 2.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e must differ from\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e is not\n        specified, then there must be exactly three columns in the query\n        result, and the column that is neither\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e nor\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n        is taken to be \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        The vertical header, displayed as the leftmost column, contains the\n        values found in column \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e, in the\n        same order as in the query results, but with duplicates removed.\n        \u003c/p\u003e\u003cp\u003e\n        The horizontal header, displayed as the first row, contains the values\n        found in column \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e,\n        with duplicates removed.  By default, these appear in the same order\n        as in the query results.  But if the\n        optional \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e argument is given,\n        it identifies a column whose values must be integer numbers, and the\n        values from \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e will\n        appear in the horizontal header sorted according to the\n        corresponding \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e values.\n        \u003c/p\u003e\u003cp\u003e\n        Inside the crosstab grid, for each distinct value \u003ccode class=\"literal\"\u003ex\u003c/code\u003e\n        of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e and each distinct\n        value \u003ccode class=\"literal\"\u003ey\u003c/code\u003e\n        of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e, the cell located\n        at the intersection \u003ccode class=\"literal\"\u003e(x,y)\u003c/code\u003e contains the value of\n        the \u003ccode class=\"literal\"\u003ecolD\u003c/code\u003e column in the query result row for which\n        the value of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n        is \u003ccode class=\"literal\"\u003ex\u003c/code\u003e and the value\n        of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e\n        is \u003ccode class=\"literal\"\u003ey\u003c/code\u003e.  If there is no such row, the cell is empty.  If\n        there are multiple such rows, an error is reported.\n        \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","manual_path":"app-psql.html#APP-PSQL-META-COMMANDS-CROSSTABVIEW","modifiers":[],"related":[{"label":"psql command-line options and complete manual","url":"/wiki/tool/psql/?v=18"}],"related_zh":[{"label":"psql 命令行选项及完整手册","url":"/wiki/tool/psql/?v=18"}],"release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.7","major":"18","manifest":{"major":"18","release":"18.7","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd","source_url":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2"},"ref":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2","revision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd"},"sections":[],"sections_zh":[],"signature":"\\crosstabview [ colV [ colH [ colD [ sortcolH ] ] ] ]","sources":[{"anchor":"APP-PSQL-META-COMMANDS-CROSSTABVIEW","file":"app-psql.html","label":"18.7 English manual · app-psql.html","sha256":"af50448485df02bdef2b72b8347192ba029c7082b8d0392ecb17db44ad533aaf","url":"/docs/18/app-psql.html#APP-PSQL-META-COMMANDS-CROSSTABVIEW"}],"spellings":["\\crosstabview"],"tables":[{"columns":[{"key":"command","label":"Command"},{"key":"modifiers","label":"Documented suffix modifiers"}],"key":"spellings","rows":[{"command":{"text":"\\crosstabview","url":"/wiki/psql/cmd-63-72-6f-73-73-74-61-62-76-69-65-77/?v=18"},"modifiers":"None listed in this signature"}],"title":"Spellings in this manual definition"}],"tables_zh":[{"columns":[{"key":"command","label":"命令"},{"key":"modifiers","label":"手册中的后缀修饰符"}],"key":"spellings","rows":[{"command":{"text":"\\crosstabview","url":"/wiki/psql/cmd-63-72-6f-73-73-74-61-62-76-69-65-77/?v=18"},"modifiers":"此语法签名未列出"}],"title":"本版手册中的写法"}],"zh_from":"same-version-manual"},"ManualEvidence":{"manual_path":"app-psql.html#APP-PSQL-META-COMMANDS-CROSSTABVIEW","release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.7","major":"18","manifest":{"major":"18","release":"18.7","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd","source_url":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2"},"ref":"https://ftp.postgresql.org/pub/source/v18.7/postgresql-18.7.tar.bz2","revision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","source_sha256":"441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd"},"sources":[{"anchor":"APP-PSQL-META-COMMANDS-CROSSTABVIEW","file":"app-psql.html","label":"18.7 English manual · app-psql.html","sha256":"af50448485df02bdef2b72b8347192ba029c7082b8d0392ecb17db44ad533aaf","url":"/docs/18/app-psql.html#APP-PSQL-META-COMMANDS-CROSSTABVIEW"}]},"MeasuredEvidence":{}},"Text":{"Collection":"psql","Key":"cmd-63-72-6f-73-73-74-61-62-76-69-65-77","SourceDatabase":"center","Version":"18","Locale":"en","Title":"\\crosstabview","Summary":"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 identified by colV becomes a vertical header and the output column identified by colH becomes a horizontal header. colD identifies the output column to display within the grid. sortcolH identifies an optional sort column for the horizontal header.","BodyHTML":"\u003cdiv\u003e\u003cdl\u003e\u003cdt id=\"APP-PSQL-META-COMMANDS-CROSSTABVIEW\"\u003e\u003cspan\u003e\u003ccode\u003e\\crosstabview [\n            \u003cem\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e\n            ] ] ] ] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Executes the current query buffer (like \u003ccode\u003e\\g\u003c/code\u003e) and\n        shows the results in a crosstab grid.\n        The query must return at least three columns.\n        The output column identified by \u003cem\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e\n        becomes a vertical header and the output column identified by\n        \u003cem\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n        becomes a horizontal header.\n        \u003cem\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e identifies\n        the output column to display within the grid.\n        \u003cem\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e identifies\n        an optional sort column for the horizontal header.\n        \u003c/p\u003e\u003cp\u003e\n        Each column specification can be a column number (starting at 1) or\n        a column name.  The usual SQL case folding and quoting rules apply to\n        column names.  If omitted,\n        \u003cem\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e is taken as column 1\n        and \u003cem\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e as column 2.\n        \u003cem\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e must differ from\n        \u003cem\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e.\n        If \u003cem\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e is not\n        specified, then there must be exactly three columns in the query\n        result, and the column that is neither\n        \u003cem\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e nor\n        \u003cem\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n        is taken to be \u003cem\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        The vertical header, displayed as the leftmost column, contains the\n        values found in column \u003cem\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e, in the\n        same order as in the query results, but with duplicates removed.\n        \u003c/p\u003e\u003cp\u003e\n        The horizontal header, displayed as the first row, contains the values\n        found in column \u003cem\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e,\n        with duplicates removed.  By default, these appear in the same order\n        as in the query results.  But if the\n        optional \u003cem\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e argument is given,\n        it identifies a column whose values must be integer numbers, and the\n        values from \u003cem\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e will\n        appear in the horizontal header sorted according to the\n        corresponding \u003cem\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e values.\n        \u003c/p\u003e\u003cp\u003e\n        Inside the crosstab grid, for each distinct value \u003ccode\u003ex\u003c/code\u003e\n        of \u003cem\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e and each distinct\n        value \u003ccode\u003ey\u003c/code\u003e\n        of \u003cem\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e, the cell located\n        at the intersection \u003ccode\u003e(x,y)\u003c/code\u003e contains the value of\n        the \u003ccode\u003ecolD\u003c/code\u003e column in the query result row for which\n        the value of \u003cem\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n        is \u003ccode\u003ex\u003c/code\u003e and the value\n        of \u003cem\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e\n        is \u003ccode\u003ey\u003c/code\u003e.  If there is no such row, the cell is empty.  If\n        there are multiple such rows, an error is reported.\n        \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","SourceRevision":"1b2d62b4845aa46374f2cb680f95d3392322cc8128646992ae4e18d0e7084915","ContentHash":"7554ad7c28b0ea70d49fce888777f2e8c0b4d92d381cf999891db5d6783d4cc6","Payload":{"description":["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 identified by colV becomes a vertical header and the output column identified by colH becomes a horizontal header. colD identifies the output column to display within the grid. sortcolH identifies an optional sort column for the horizontal header."],"manual_html":"\u003cdiv\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"APP-PSQL-META-COMMANDS-CROSSTABVIEW\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003e\\crosstabview [\n            \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e\n            [ \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e\n            ] ] ] ] \u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        Executes the current query buffer (like \u003ccode class=\"literal\"\u003e\\g\u003c/code\u003e) and\n        shows the results in a crosstab grid.\n        The query must return at least three columns.\n        The output column identified by \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e\n        becomes a vertical header and the output column identified by\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n        becomes a horizontal header.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e identifies\n        the output column to display within the grid.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e identifies\n        an optional sort column for the horizontal header.\n        \u003c/p\u003e\u003cp\u003e\n        Each column specification can be a column number (starting at 1) or\n        a column name.  The usual SQL case folding and quoting rules apply to\n        column names.  If omitted,\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e is taken as column 1\n        and \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e as column 2.\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e must differ from\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e.\n        If \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e is not\n        specified, then there must be exactly three columns in the query\n        result, and the column that is neither\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e nor\n        \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n        is taken to be \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolD\u003c/code\u003e\u003c/em\u003e.\n        \u003c/p\u003e\u003cp\u003e\n        The vertical header, displayed as the leftmost column, contains the\n        values found in column \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e, in the\n        same order as in the query results, but with duplicates removed.\n        \u003c/p\u003e\u003cp\u003e\n        The horizontal header, displayed as the first row, contains the values\n        found in column \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e,\n        with duplicates removed.  By default, these appear in the same order\n        as in the query results.  But if the\n        optional \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e argument is given,\n        it identifies a column whose values must be integer numbers, and the\n        values from \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e will\n        appear in the horizontal header sorted according to the\n        corresponding \u003cem class=\"replaceable\"\u003e\u003ccode\u003esortcolH\u003c/code\u003e\u003c/em\u003e values.\n        \u003c/p\u003e\u003cp\u003e\n        Inside the crosstab grid, for each distinct value \u003ccode class=\"literal\"\u003ex\u003c/code\u003e\n        of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e and each distinct\n        value \u003ccode class=\"literal\"\u003ey\u003c/code\u003e\n        of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e, the cell located\n        at the intersection \u003ccode class=\"literal\"\u003e(x,y)\u003c/code\u003e contains the value of\n        the \u003ccode class=\"literal\"\u003ecolD\u003c/code\u003e column in the query result row for which\n        the value of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolH\u003c/code\u003e\u003c/em\u003e\n        is \u003ccode class=\"literal\"\u003ex\u003c/code\u003e and the value\n        of \u003cem class=\"replaceable\"\u003e\u003ccode\u003ecolV\u003c/code\u003e\u003c/em\u003e\n        is \u003ccode class=\"literal\"\u003ey\u003c/code\u003e.  If there is no such row, the cell is empty.  If\n        there are multiple such rows, an error is reported.\n        \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","related":[{"label":"psql command-line options and complete manual","url":"/wiki/tool/psql/?v=18"}],"sections":[],"tables":[{"columns":[{"key":"command","label":"Command"},{"key":"modifiers","label":"Documented suffix modifiers"}],"key":"spellings","rows":[{"command":{"text":"\\crosstabview","url":"/wiki/psql/cmd-63-72-6f-73-73-74-61-62-76-69-65-77/?v=18"},"modifiers":"None listed in this signature"}],"title":"Spellings in this manual definition"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":[{"Version":"18","Ordinal":0,"Command":"\\crosstabview","Signature":"\\crosstabview [ colV [ colH [ colD [ sortcolH ] ] ] ]","Modifiers":[]}],"SQLState":null,"Evidence":null}
