This tag is used to perform several nested SQL queries. The tag union will be as the tag root which encapsulates the selects.
1 union
<union
prefix='prefix'
type='all'
prepare='true|false'
>
<select /> *
</union>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Aprefix | string | Prefix of the variables which are generated with the name of the selected columns and which has the value of the column for each register. | |||
Atype | string | Indicate if the union is of all type, so if it is UNION ALL. | |||
Aprepare | boolean | False to issue the prepare of the selects contained in the union. |
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Eselect | string | Query select in XSQL Select. |
Returns | |
---|---|
Type | Description |
integer | Number of selected registers. |
Example
Queries sqls with union.
Copy
<xsql-script name='sql_sql2xml1'> <body> <foreach> <union prefix='m_'> <select> <columns>'COM' tab, gcompedh.third</columns> <from table='gcompedh' /> </select> <select> <columns>'VEN tab, gvenpedh.third</columns> <from table='gvenpedh' /> </select> </untion> <do> <println><m_tab/>: <m_third /></println> </do> </foreach> </body> </xsql-script>