I've a table where there are 4 columns for Qty(Q1, Q2, Q3, Q4) and
another column as Virtual_Pack. I've to write a query to update
Virtual_Pack column. The logic is as follows
1 virtual pack consists of Q1 = 10, Q2 = 2, Q3 = 3.5, Q4 = 6
Lets say Q1 = 20, Q2 = 2, Q3 = 20, Q4 = 6 then the Virtual_Pack will
be = 1 because Q2 = 2
Example Q1 = 30, Q2 = 5, Q3 = 8, Q4 = 15 then the Virtual_Pack will be
= 2
If any of the Q1, Q2, Q3 or Q4 = 0 then Virtual_Pack will be = 0
I don't want to write a cursor or do it in a loop. Any thoughts how
virtual_pack column can be updated in a single query.
Thanks in advance.
Subodh
another column as Virtual_Pack. I've to write a query to update
Virtual_Pack column. The logic is as follows
1 virtual pack consists of Q1 = 10, Q2 = 2, Q3 = 3.5, Q4 = 6
Lets say Q1 = 20, Q2 = 2, Q3 = 20, Q4 = 6 then the Virtual_Pack will
be = 1 because Q2 = 2
Example Q1 = 30, Q2 = 5, Q3 = 8, Q4 = 15 then the Virtual_Pack will be
= 2
If any of the Q1, Q2, Q3 or Q4 = 0 then Virtual_Pack will be = 0
I don't want to write a cursor or do it in a loop. Any thoughts how
virtual_pack column can be updated in a single query.
Thanks in advance.
Subodh
Comment