Database Reference
In-Depth Information
Figure 2-20.
An example three-table join
In this example, the following modifications have been applied to the query:
•
Changed the alias of the
ORDER_TOTAL
column to
SUM_OF_ORDERS
•
Limited the result set to only those records where
ORDER_TOTAL
is less
than 500
•
Sorted the records returned by
CUST_LAST_NAME
,
CUST_FIRST_NAME
ascending
•
Performed a
SUM
function on the
ORDER_TOTAL
column
•
Grouped
the
query
by
USER_NAME
,
CUSTOMER_ID
,
CUST_FIRST_NAME
,
CUST_LAST_NAME
Based on the column selections and the restrictions and changes introduced in the
Conditions tab, the SQL statement (as it appears in the SQL tab) looks like this:
select "DEMO_USERS"."USER_NAME" as "USER_NAME",
"DEMO_CUSTOMERS_2"."CUSTOMER_ID" as
"CUSTOMER_ID",
"DEMO_CUSTOMERS_2"."CUST_FIRST_NAME" as
"CUST_FIRST_NAME",
"DEMO_CUSTOMERS_2"."CUST_LAST_NAME" as
"CUST_LAST_NAME",