Examples
SECTION 12 Databases
198
12-10 Examples
12-10-1 Simple Relation Hierarchy example:
SHAPE {select * from customers}
APPEND ({select * from orders} AS rsOrders
RELATE customerid TO customerid)
The parent recordset contains all fields from the Customers table and a field
called rsOrders. rsOrders provides a reference to the child recordset, and
contains all the fields from the Orders table. The other examples use a similar
notation.
12-10-2 Compound Relation Hierarchy example:
This sample illustrates a three-level hierarchy of customers, orders, and order
details:
SHAPE {SELECT * from customers}
APPEND ((SHAPE {select * from orders}
APPEND ({select * from [order details]} AS
rsDetails
RELATE orderid TO orderid)) AS rsOrders
RELATE customerid TO customerid)
In addition to the Simple Relation Hierarchy example, the Order ID is now
used to create a recordset containing the order details for the shown order.
12-10-3 Hierarchy with Aggregate example:
SHAPE (select * from orders}
APPEND ({select od.orderid, od.UnitPrice * od.quantity
as ExtendedPrice
from [order details] As od}
RELATE orderid TO orderid) As rsDetails,
SUM(ExtendedPrice) AS OrderTotal
This example creates a Recordset of all the orders and their details, and adds
a field called ExtendedPrice to store the total order value for each record, and
sums all the ExtendedPrice values which is stored in Order Total.
12-10-4 Group Hierarchy example:
SHAPE {select customers.customerid AS cust_id,
orders.*
from customers inner join orders on
customers.customerid =
orders.customerid} AS rsOrders
COMPUTE rsOrders BY cust_id
12-10-5 Group Hierarchy with Aggregate example:
SHAPE
SHAPE {select customers.*, orders.orderid,
orders.orderdate fromc ustomers inner join orders
on customers.customerid = orders.customerid}
APPEND ({select od.orderid,od.unitprice *
od.quantity as ExtendedPrice from order details]as
od} AS rsDetails
RELATE orderid TO orderid),
SUM(rsDetails.ExtendedPrice) AS OrderTotal) AS
rsOrders
Содержание CX-Supervisor
Страница 1: ...CX Supervisor Software Cat No W10E EN 01 User Manual Software Release 3 1...
Страница 3: ...Copyright Notice 2...
Страница 16: ...15...
Страница 17: ...16...
Страница 27: ...Tip of the Day SECTION 1 Graphics Editor 26...
Страница 35: ...CX Supervisor Preferences SECTION 2 Pages 34...
Страница 79: ...Responding to Events SECTION 5 ActiveX Objects 78...
Страница 115: ...Printing the Graphics Library SECTION 7 Graphics Library 114...
Страница 181: ...Data Logging SECTION 11 Data Logging 180...
Страница 201: ...Examples SECTION 12 Databases 200...
Страница 243: ...Performance Monitor SECTION 16 Application Analysis Performance Monitor 242...
Страница 253: ...Using with Omron s CX Server OPC SECTION 17 Using CX Supervisor as an OPC Cli 252...
Страница 259: ...Creating a CX Supervisor Client application SECTION 18 Connecting to a remote CX 258...
Страница 263: ...Adding a Point Linked to a Parameter SECTION 19 Connecting to Omron Industrial 262...
Страница 271: ...Data Logging SECTION 20 Best Practices 270...
Страница 275: ...Configuring a Server PC running Windows NT or 2000 Appendix A Configuring a PC 274...
Страница 277: ...Appendix B Frequently Asked Questions 276...
Страница 296: ...Appendix B Frequently Asked Questions 295...
Страница 297: ...Appendix B Frequently Asked Questions 296...
Страница 298: ...Appendix B Frequently Asked Questions 297...
Страница 299: ...Appendix B Frequently Asked Questions 298...
Страница 333: ...Revision history 332...