Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

SQL load script how to compute start and end time as download ?

Hi All

I want to know how to write in SQL for the above mentioned.

after load below script :-

CONNECT TO [Provider=SQLOLEDB.1;Persist Security Info=False;User ID=SA;Initial Catalog=andonDatabas;Data Source=Paul;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=PAUL;Use Encryption for Data=False;Tag with column collation when possible=False];

select * from record_produksi_plc;

select * from record_downtime_plc;

select * from record_reject_detail_plc;

I get 2 field name , downtime_start_time and downtime_stop_time. i like to compute :-

downtime=downtime_start_time - downtime_stop_time


How to do it ?


Paul

1 Solution

Accepted Solutions
SergeyMak
Partner Ambassador
Partner Ambassador

Hi Paul,

Try this

LOAD

*,

downtime_start_time - downtime_stop_time AS downtime

select *

from record_downtime_plc;

Regards,

Sergey

Regards,
Sergey

View solution in original post

3 Replies
SergeyMak
Partner Ambassador
Partner Ambassador

Hi Paul,

Try this

LOAD

*,

downtime_start_time - downtime_stop_time AS downtime

select *

from record_downtime_plc;

Regards,

Sergey

Regards,
Sergey
SergeyMak
Partner Ambassador
Partner Ambassador

Or it would be better

Time(Num(downtime_end_time)-Num(downtime_start_time),'s')

You will have downtime in seconds


Regards,

Sergey

Regards,
Sergey
paulyeo11
Master
Master
Author

Hi Sir

Thank you for sample code help a lot , it work now :-

LOAD

*,

Time(Num(downtime_end_time)-Num(downtime_start_time),'s') as downtime_;

//downtime_end_time - downtime_start_time AS downtime;

select * from record_downtime_plc;

Paul