Current Sybase SQL Query
(Referance = http://manuals.sybase.com/onlinebook...g1100e/sqlref/)
[CODE=sql]SELECT
requisition.req n
requisition.pn
requisition.ord _time
status.status
status.status_t ime
requisition.del _time
DATEDIFF(HH, requisition.ord _time, requisition.del _time) 'HR'
FROM
requisition,
status
WHERE
requisition.req n *= status.reqn
AND DATEPART(year, requisition.del _time) = 2010
AND DATEPART(month, requisition.del _time) = 7[/CODE]
Current output:
Ideal Output: There is only one record for each REQN and the STATUS becomes a header with the coresponding time as a field for that column/record.
(Referance = http://manuals.sybase.com/onlinebook...g1100e/sqlref/)
[CODE=sql]SELECT
requisition.req n
requisition.pn
requisition.ord _time
status.status
status.status_t ime
requisition.del _time
DATEDIFF(HH, requisition.ord _time, requisition.del _time) 'HR'
FROM
requisition,
status
WHERE
requisition.req n *= status.reqn
AND DATEPART(year, requisition.del _time) = 2010
AND DATEPART(month, requisition.del _time) = 7[/CODE]
Current output:
Code:
REQN PN ORD-TIME STATUS STATUS-TIME DEL-TIME HR ------------------------------------------------------------ 5A00 01201 10:00 Validating 10:00 19:46 9 5A00 01201 10:00 In Process 10:26 19:46 9 5A00 01201 10:00 Delivery 14:19 19:46 9 5A00 01201 10:00 Issued 10:00 19:46 9 5A00 01201 10:00 Completed 19:46 19:46 9 6R21 24582 02:45 Validating 02:45 07:57 5 6R21 24582 02:45 In Process 03:01 07:57 5 6R21 24582 02:45 Delivery 06:27 07:57 5 6R21 24582 02:45 Issued 07:02 07:57 5 6R21 24582 02:45 Completed 07:57 07:57 5
Ideal Output: There is only one record for each REQN and the STATUS becomes a header with the coresponding time as a field for that column/record.
Code:
REQN PN ORD-TIME VALIDATING IN-PROCESS DELIVERY ISSUED COMPLETED DEL-TIME HR --------------------------------------------------------------------------------- 5A00 01201 10:00 10:00 10:26 14:19 10:00 19:46 19:46 9 6R21 24582 02:45 02:45 03:01 06:27 07:02 07:57 07:57 5
Comment