Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: How To (Forms, Reports, and more) > Queries/Views > Query Builder > Technical Documents > Building a Query Using a Union > Quarterly Summary Query

Column Aliases

Scroll Prev Top Next More

With non-descriptive column headings, the Query Builder allow the ability to assign column aliases. By using column aliases, when the query is displayed, the results will be easier to understand.

 

1.If you have not done so already, close the Data Browser by pressing the [Esc] key.

2.From the main menu bar, choose "Query" > "Column Aliases.."

 

The "Create Alias" dialog will appear.

 

3.First, enable aliases by selecting the "Use Column Aliases" check box.

 

The panel will become editable with the "Column Name", "Alias Name", and "Modify" panels.

 

4.Select the first item in the "Column Name" panel.

5.The corresponding value displayed in the "Alias Name" will then appear in the "Modify" panel below.

6.Overwrite the value with the word "Quarter", and select the "Modify Current Selection" button.

7.Select the first item in the "Column Name" panel.

8.The corresponding value displayed in the "Alias Name" will then appear in the "Modify" panel below.

9.Overwrite the value with the word "TotalSales", and select the "Modify Current Selection" button.

10.Press the OK button to save the aliases.

 

In the Query Builder main window, you should see the SQL syntax displayed in the bottom of the page as:

 

(Quarter,TotalSales)

SELECT 1,(SUM( T1.InvoiceTotal ))

FROM  InvoiceHeader T1

WHERE TransDate BETWEEN 01/01/2018 AND 03/31/2018

UNION SELECT 2,(SUM( T1.InvoiceTotal ))

FROM  InvoiceHeader T1

WHERE T1.TransDate  BETWEEN 04/01/2018 AND 06/30/2018

UNION SELECT 3,(SUM( T1.InvoiceTotal ))

FROM  InvoiceHeader T1

WHERE T1.TransDate BETWEEN 07/01/2018 AND 09/30/2018

UNION SELECT 4,(SUM( T1.InvoiceTotal ))

FROM  InvoiceHeader T1

WHERE T1.TransDate BETWEEN 10/01/2018 AND 12/31/2018