This existing Crystal Report has a parameter option to run based on the time of the last modification of the order. Then all orders last modified during the previous x hours can be displayed. This worked until the modification date details were moved to a separate history table. Now, as before, there is still a need to only collect one record for each order, but so far it is pulling multiples with the left join used in CR.
What are the options to integrate this query with a subquery to collect the needed time details? Would adding a SQL command be a good method? Thank you, Hallux.
----------------------------------------------------------
CR Professional; Product Type: Full Product Version 10.0.0.533
Oracle 10G Enterprise Edition Release 10.2
----------------------------------------------------------
SELECT o.orders_no,
o.orders_due_dt,
oh.ordershist_modate,
oh.ordershist_motime,
oh.ordershist_serial
FROM orders o
LEFT OUTER JOIN
ordershist oh
ON o.orders_no = oh.orders_no
WHERE o.orders_no = 1
AND oh.ordershist_serial = (SELECT MIN (ordershist_serial)
FROM ordershist
WHERE ordershist.orders_no = 1)
table: ORDERS
ORDERS_NO ORDERS_DUE_DT ORDERS_DESC
1 10/01/2010 steel paperclip
table: ORDERSHIST
ORDERSHIST_SERIAL ORDERS_NO ORDERSHIST_MODATE ORDERSHIST_MOTIME ORDERSHIST_EDITNM
535 1 09/14/2010 1284482929 BJohnson
536 1 09/17/2010 1284738348 BJohnson
538 1 09/20/2010 1284991254 BJohnson
539 1 09/20/2010 1284991426 CAndrus
What are the options to integrate this query with a subquery to collect the needed time details? Would adding a SQL command be a good method? Thank you, Hallux.
----------------------------------------------------------
CR Professional; Product Type: Full Product Version 10.0.0.533
Oracle 10G Enterprise Edition Release 10.2
----------------------------------------------------------
SELECT o.orders_no,
o.orders_due_dt,
oh.ordershist_modate,
oh.ordershist_motime,
oh.ordershist_serial
FROM orders o
LEFT OUTER JOIN
ordershist oh
ON o.orders_no = oh.orders_no
WHERE o.orders_no = 1
AND oh.ordershist_serial = (SELECT MIN (ordershist_serial)
FROM ordershist
WHERE ordershist.orders_no = 1)
table: ORDERS
ORDERS_NO ORDERS_DUE_DT ORDERS_DESC
1 10/01/2010 steel paperclip
table: ORDERSHIST
ORDERSHIST_SERIAL ORDERS_NO ORDERSHIST_MODATE ORDERSHIST_MOTIME ORDERSHIST_EDITNM
535 1 09/14/2010 1284482929 BJohnson
536 1 09/17/2010 1284738348 BJohnson
538 1 09/20/2010 1284991254 BJohnson
539 1 09/20/2010 1284991426 CAndrus