How To Create Store Procedures With Combine Many Table And Looping

Step By Step Create Store Procedure with join table and aritmatics summary

How to create a procedural store to fill end_date_time in shipment_assignment table based on data search begin_date_time matching start_date_time in table event_with_location with condition vehicle_id same with origin as prefix with event_type = 31 and end_date_time based on destination with search data with event_type = 30
And add field enter_time = start_date_time with event = 31, end_date_time = start_date_time with event_type = 30
And add the min, max and avg temperature fields to the same divergence as begin_date_time to end_date_time
And add duration with format dd: hh: mm between begin_date_time and end_date_time difference
And active = 0 when end_time is filled

<img

I Have Shares For Main Table for that case/...

is anyone can help me ?

Hello Ruben, please provide data sample as follows. As you can see it will take a lot of work for someone else to do all of this for you from an image

create table #shipment_assignment(id int, vehicle_id int , shipment_no varchar(10), 
origin_id int , destination_id int, begin_date_time datetime, end_date_time datetime,  
status varchar(15), active bit);

insert into #shipment_assignment
select 206, 10884919, 'A01' 105945, 103025, '2017-06-12', null, null, 1

please do this for all of the tables listed?

hi yozias.
thanks for ur help. i have create and fill all the datas contain ..but my goal is like pict result page 1 and page 2
. i think it should be using store procedure like i explain Above

"How to create a procedural store to fill end_date_time in shipment_assignment table based on data search begin_date_time matching start_date_time in table event_with_location with condition vehicle_id same with origin as prefix with event_type = 31 and end_date_time based on destination with search data with event_type = 30
And add field enter_time = start_date_time with event = 31, end_date_time = start_date_time with event_type = 30
And add the min, max and avg temperature fields to the same divergence as begin_date_time to end_date_time
And add duration with format dd: hh: mm between begin_date_time and end_date_time difference
And active = 0 when end_time is filled "

and i have share all the table above

Pictures don't do anything for us... I you want a working solution, we have to be able create tables and insert data in order to test possible solutions.
If you provide create table statements and insert statements that we can copy/pate into SSMS, you'll find there is no shortage of people willing to help work on the problem.
If you're not willing to do this, why would anyone else?

1 Like