# Query Builder

## Content

The Query Builder composes a query from tables, columns, joins, filter conditions, and aliases. It opens when a Data View is added or edited.
The layout contains three numbered, collapsible sections on the left: **Tables**, **Conditions**, and **Result Preview**. The **Schema** panel appears on the right, with the **Data View Name** text box and **Save Data View** button below it.
![image](https://cdn.mescius.io/document-site-files/images/d955dec4-5c03-497a-875e-1da749bee0ab/image-20261016.4934f5.png?width=800)

## Selecting Tables and Columns

The **Schema** panel lists the tables in the data source and their columns. The **Search Tables** box filters the list.

1. In the **Schema** panel, click the ![image](https://cdn.mescius.io/document-site-files/images/d955dec4-5c03-497a-875e-1da749bee0ab/image-20261016.177012.png?width=20) **Add Table to Query** located next to a table. The table appears as a card in the **Tables** section.
2. Select the required column check boxes. **Select All** selects every column, and **Search Columns** filters the column list.

The selected columns define the columns of the generated query. Click ![image](https://cdn.mescius.io/document-site-files/images/d955dec4-5c03-497a-875e-1da749bee0ab/image-20261016.8bd564.png?width=20) **Remove** on a table card to remove the table from the query.
The number beside each table in the **Schema** panel indicates its instances in the query
![](https://cdn.mescius.io/document-site-files/images/d955dec4-5c03-497a-875e-1da749bee0ab/AddingTables-20261016.800de8.gif?width=800)

## Creating Joins

1. Add a second table from the **Schema** panel.
2. Click **Create Join** on the table that will be the right table of the join.
3. In the join dialog, select the other table from **Left Table**. **Right Table** displays the table on which **Create Join** was clicked.
4. Select a column for each table from its **Choose Column** list.
5. Click **Create Join**. A join icon appears beside each joined column.

The table on which **Create Join** is clicked becomes the right table of the join.
![](https://cdn.mescius.io/document-site-files/images/d955dec4-5c03-497a-875e-1da749bee0ab/CreatingJoins-20261016.a00706.gif?width=800)

>type=note
> **Note**: Data Wizard supports INNER joins only.

## Editing a Join

A join icon (![image](https://cdn.mescius.io/document-site-files/images/d955dec4-5c03-497a-875e-1da749bee0ab/image-20261016.235e4b.png?width=20)) appears beside the joined column on each table.

1. Click ![image](https://cdn.mescius.io/document-site-files/images/d955dec4-5c03-497a-875e-1da749bee0ab/image-20261016.4aa217.png?width=20) **Edit Join**. The join details appear, with options to ![image](https://cdn.mescius.io/document-site-files/images/d955dec4-5c03-497a-875e-1da749bee0ab/image-20261016.fe54f8.png?width=20) edit or ![image](https://cdn.mescius.io/document-site-files/images/d955dec4-5c03-497a-875e-1da749bee0ab/image-20261016.eed8cd.png?width=20) remove the join.
2. Click ![image](https://cdn.mescius.io/document-site-files/images/d955dec4-5c03-497a-875e-1da749bee0ab/image-20261016.fe54f8.png?width=20) **Edit** to open the join editor.
3. Modify the join and click **Save Join**.
4. Click **Done** to close the join details.

To remove the join, click ![image](https://cdn.mescius.io/document-site-files/images/d955dec4-5c03-497a-875e-1da749bee0ab/image-20261016.eed8cd.png?width=20) **Remove** in the join details.
![](https://cdn.mescius.io/document-site-files/images/d955dec4-5c03-497a-875e-1da749bee0ab/Editing%26removingJOINS-20261016.30c99c.gif?width=800)

## Filtering Data

Filter conditions specify which rows the query returns. Define conditions in the **Conditions** section of the Query Builder.

1. Click **Add Condition**.
2. Select a table, a column, and an operator.
3. Enter a value. For a date column, select a date and enter a time. The **Is Null** and **Is Not Null** operators do not require a value.

Until the condition is complete, **Result Preview** displays a validation message instead of data, such as **Please select an operator.** or **Please enter a value.**
Available operators depend on the column data type:

| @cols=1:Operator | @cols=1:Matches rows where the column | @cols=1:Numeric and date columns | @cols=1:Text columns |
| -------- | ----------------------------- | ------------------------ | ------------ |
| @cols=1:@rows=1:Equals | @cols=1:@rows=1:Equals the value | @cols=1:@rows=1:Yes | @cols=1:@rows=1:Yes |
| @cols=1:@rows=1:Not Equals | @cols=1:@rows=1:Does not equal the value | @cols=1:@rows=1:Yes | @cols=1:@rows=1:Yes |
| @cols=1:@rows=1:Greater Than | @cols=1:@rows=1:Is greater than the value | @cols=1:@rows=1:Yes | @cols=1:@rows=1:No |
| @cols=1:@rows=1:Greater Than Or Equal | @cols=1:@rows=1:Is greater than or equal to the value | @cols=1:@rows=1:Yes | @cols=1:@rows=1:No |
| @cols=1:@rows=1:Less Than | @cols=1:@rows=1:Is less than the value | @cols=1:@rows=1:Yes | @cols=1:@rows=1:No |
| @cols=1:@rows=1:Less Than Or Equal | @cols=1:@rows=1:Is less than or equal to the value | @cols=1:@rows=1:Yes | @cols=1:@rows=1:No |
| @cols=1:@rows=1:Start With | @cols=1:@rows=1:Starts with the value | @cols=1:@rows=1:No | @cols=1:@rows=1:Yes |
| @cols=1:@rows=1:End With | @cols=1:@rows=1:Ends with the value | @cols=1:@rows=1:No | @cols=1:@rows=1:Yes |
| @cols=1:@rows=1:Contains | @cols=1:@rows=1:Contains the value | @cols=1:@rows=1:No | @cols=1:@rows=1:Yes |
| @cols=1:@rows=1:Is Null | @cols=1:@rows=1:Contains no value | @cols=1:@rows=1:Yes | @cols=1:@rows=1:Yes |
| @cols=1:@rows=1:Is Not Null | @cols=1:@rows=1:Contains a value | @cols=1:@rows=1:Yes | @cols=1:@rows=1:Yes |

 Each condition row provides duplicate and remove actions. The duplicate action copies the condition; the remove action deletes it.
The **And** and **Or** options determine how conditions in a group are combined. Click **Add Group** to add a nested group with its own **And** or **Or** setting.
![image](https://cdn.mescius.io/document-site-files/images/d955dec4-5c03-497a-875e-1da749bee0ab/image-20261016.e85973.png?width=800)

## Working with Table Aliases

An alias names each table in the query. It appears in the **Alias name** box on the table card and in the generated query.
Data Wizard generates each default alias from the table name:

* The first table receives the first letter of its name, such as `i` for Invoices.
* Further instances of the same table receive a numeric suffix: `i1`, `i2`, and so on.
* A different table starting with the same letter receives a repeated letter. For example, InvoiceItems added after Invoices receives `ii`. Further instances of InvoiceItems receive `ii1`, `ii2`, and so on.

To specify an alias manually, enter it in **Alias name**.
![image](https://cdn.mescius.io/document-site-files/images/d955dec4-5c03-497a-875e-1da749bee0ab/image-20261016.a56ba7.png?width=800)

<br>
