0
Former Member
Sep 02, 2009 at 04:27 PM

# needing ideas to calculated energy spend per shift

13 Views

Hi, i have a problem, im trying to make an transaction that gonna calculate the energy spent per shift, in production line i have an infinite counter that is always increasing.

in the beggining i made an transaction that calculation the energy spent per line and day (http://img9.imageshack.us/img9/6659/transenergy.jpg) and with this SQL :

select trunc(a."DateTime") "DateTime", max(a."Energy") as LINE_ENERGY, "Line_Number"

from z_opc_tags a

where a."Line_Number" = '10111]'

and trunc(a."DateTime") >= trunc(to_date('22.08.2009', 'dd.mm.YYYY') ) and trunc(a."DateTime") <= trunc(to_date('28.08.2009 23:59:59', 'dd.mm.YYYY hh24:mi:ss'))

group by trunc(a."DateTime"), "Line_Number"

order by trunc(a."DateTime") asc

could someone give me little tip to begin....i know that i have to catch the value of shift1,shift2 and shift3 and because the counter is infinite i have to make calculate like...shift1 = shift1......shift2 = shift2 - shift1.. and shift3 = shift3 - shift2 - shift1....i think

regards

Mário