Paul12345671
Technical User
Hello,
I'm afraid that I've been struggling with this for ages. I'm using CR XI to report from an Oracle 9i database. I have an 'ORDERS' table and an 'ORDERSLOG' table. Once entered, an order will exist permanently in the ORDERS table, but it's status may change in the ORDERSLOG table. a simplified version is shown below. Order No. 53 was created, cancelled, then reactivated.
ORDERS
OrderNo OrderType
53 5
ORDERSLOG
OL_No OrderNo OrderStatus StatusStartDate StatusEndDate
56 53 1 23/10/2008 30/10/2008
57 53 2 30/10/3008 2/11/2008
58 53 1 2/11/2008 <NULL>
ORDERSTATUS
Status Description
1 Active
2 Cancelled
ORDERTYPES
OrderTypeCd OrderTypeDs
5 Blinds
I would like to generate a report showing the order types and number of orders that have been 'active' at least some time in the last quarter. For example, using the above data, the report would say:
Blinds 1
______________
Total Blinds 1
Note that even though the order has been active twice in the quarter, because it is only a single order it should only be counted once.
I've tried doing sub queries, but the computer just sits there (it may be that I'm generating a massive result set somehow.) I said (select max(OL_No) from orderslog where orderslog.orderno = orders.orderno). That worked until I tried to return the item descriptions using a LEFT JOIN. Any help would be greatly appreciated. Thank you.
I'm afraid that I've been struggling with this for ages. I'm using CR XI to report from an Oracle 9i database. I have an 'ORDERS' table and an 'ORDERSLOG' table. Once entered, an order will exist permanently in the ORDERS table, but it's status may change in the ORDERSLOG table. a simplified version is shown below. Order No. 53 was created, cancelled, then reactivated.
ORDERS
OrderNo OrderType
53 5
ORDERSLOG
OL_No OrderNo OrderStatus StatusStartDate StatusEndDate
56 53 1 23/10/2008 30/10/2008
57 53 2 30/10/3008 2/11/2008
58 53 1 2/11/2008 <NULL>
ORDERSTATUS
Status Description
1 Active
2 Cancelled
ORDERTYPES
OrderTypeCd OrderTypeDs
5 Blinds
I would like to generate a report showing the order types and number of orders that have been 'active' at least some time in the last quarter. For example, using the above data, the report would say:
Blinds 1
______________
Total Blinds 1
Note that even though the order has been active twice in the quarter, because it is only a single order it should only be counted once.
I've tried doing sub queries, but the computer just sits there (it may be that I'm generating a massive result set somehow.) I said (select max(OL_No) from orderslog where orderslog.orderno = orders.orderno). That worked until I tried to return the item descriptions using a LEFT JOIN. Any help would be greatly appreciated. Thank you.