|
|
|
|
|
- Overview
- Example 1: Simple query
- Query to create
- How to create this query?
- Example 2: Advanced query
- Query to create
- How to create this query?
Example for creating a select query
This help page explains how to create two select queries: - a simple query.
- an advanced query.
These two queries are created from the "WD Queries" project (provided with WINDEV). Query to create Selecting the characteristics of the customers (number, name and phone) who live in Paris. How to create this query? The steps are as follows: - Click in the quick access buttons. The creation window appears: click "Query". The query creation wizard starts.
- Select "Select" and validate. The query description window appears.
- Enter the name and caption of the query.
- In the section on the left, double-click on the items "CustomerNum", "CustomerName", "City" and "Phone" of the CUSTOMER data file.
- In the middle section, select the "CUSTOMER.City" item.
- Click the "Selection conditions" button and select "New condition". The wizard for creating a selection condition is displayed.
- Select the selection criterion ("starts with"). Select "the value" and enter "Paris" in the "Value" control. Validate.
- Click the "Display/Rename" button.
- Answer "No" to "Display this item" and validate.
Remark: There is no need to display the values of the "City" item in the query result: all customers selected by the query live in Paris. - Validate the query description window. The graphic representation of query is automatically displayed in the query editor.
- Save the query ().
Example 2: Advanced query Query to create Displaying the number of orders placed by each customer living in Paris from 01/01/2014 to 01/31/2014. The important points in the query are as follows: - defining a selection condition on the city of customers.
- defining a selection condition on the date of orders.
- counting the orders placed by each customer.
How to create this query? The steps are as follows: - Click in the quick access buttons. The creation window appears: click "Query". The query creation wizard starts.
- Select "Select" and validate. The query description window appears.
- Enter the name and caption of the query.
- In the section of the left, double-click on the items "CustomerNum", CustomerName" and "City" of the CUSTOMER data file and on the "OrderDate" of the ORDER data file.
- In the middle section, select the "CUSTOMER.City" item.
- Click the "Selection conditions" button and select "New condition". The wizard for creating a selection condition is displayed.
- Select the selection criterion ("starts with"). Select "The value" and enter "Paris" in the "Value" control. Validate.
- Click the "Display/Rename" button.
- Answer "No" to "Display this item" and validate.
Remark: There is no need to display the values of the "City" item in the query result: all customers selected by the query live in Paris. - Click the "Count" button and select "On a new item". The window for item selection is displayed.
- Display the "Other items" tab, select the "OrderNum" item and validate the window ("Select" button). The description window of a count is displayed.
- Validate the description window of the count.
- In the middle section, select the "ORDERS.OrderDate" item.
- Click the "Between two dates" button. The description window of a condition is displayed.
- Enter "01/01/2022" in the first "Value" control and "31/01/2022" in the second "Value" control. Validate.
- Validate the query description window. The graphic representation of query is automatically displayed in the query editor.
- Save the query ().
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|