Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Mikiyo
Contributor
Contributor

Production time of the first product on the production line

Hi,

there is a question which bother me a lot,can anybody help me?thanks in advance.

i want to know the Production time of the first product on the production line,but how can i calculate it,examples are as follows:

date    product     working_procedure    begintime     endtime         code

7/8             A                            1                             7:00:35           7:01:45               1

7/8             A                            2                             7:01:45           7:03:23               1

7/8             A                            3                             7:03:23           7:04:35               1

7/8             B                            1                             7:04:23           7:05:04               2

7/8             A                            1                             7:05:34           7:06:12               3

7/8             B                            2                             7:05:05           7:07:23               2

7/8             A                            2                              7:06:45          7:07:34               3

7/8             A                            3                              7:08:56           7:09:23              3

7/8             B                            3                             7:09:34           7:10:23               2

every product has 3 procedures,code means the order of production,i want to get a table like this:

date    product     timecount(s)

7/8             A                    240

7/8             B                    360

timecount  =  endtime - begintime,only need to calculate the first one of every product

 

1 Reply
justISO
Specialist
Specialist

Hi, if you want to calculate this in script level, you could try approach like this:

NoConcatenate
timecount:
LOAD
date, 
product,
sum(endtime - begintime) *24*60*60 as timecount
RESIDENT your_main_table
WHERE code='1'
GROUP BY date, product;