anandsatchin
IS-IT--Management
Hi...
I need to exectue all the 6 queries in a sequential order which are stored in stored procedure.
I am just wondering is there any way to make
general into one query with CASE statements or any other better statement I can use.
Cheers
DB: MySql 5.0
Table Name:
sorting_temp
Column Names:
status_update
status_code
date_of_change
product_category_id
doa_or_nff
current_status_of_job
date_into_sorting
date_out_sorting
date_passed_to_sales
1.
update sorting_temp
set status_update='Y', status_code = 'JJJJ', date_of_change = date_passed_to_sales
where (date_passed_to_sales is not null or date_passed_to_sales != '')
2.
update sorting_temp
set status_update='Y', status_code = 'GGGG', date_of_change = date_out_sorting
where current_status_of_job = 'BER-SCRAPPED' and status_update ='N';
3.
update sorting_temp
set status_update='Y', status_code = 'JJJJ', date_of_change = date_out_sorting
where (doa_or_nff = 'NFF' or doa_or_nff = 'CDNFF')
and (date_out_sorting is not null or date_out_sorting != '')
and status_update ='N';
4.
update sorting_temp
set status_update='Y', status_code = 'EEEE', date_of_change = date_out_sorting,
where doa_or_nff = 'BER' and status_update ='N';
5.
update sorting_temp
set status_update='Y', status_code = 'BBBB', date_of_change = date_into_sorting,
where product_category_id = 'NOT RECEIVED' and status_update ='N';
6.
update sorting_temp
set status_update='Y', status_code = 'DDDD', date_of_change = date_into_sorting,
where doa_or_nff = 'EMPTY BOX' and status_update ='N';
I need to exectue all the 6 queries in a sequential order which are stored in stored procedure.
I am just wondering is there any way to make
general into one query with CASE statements or any other better statement I can use.
Cheers
DB: MySql 5.0
Table Name:
sorting_temp
Column Names:
status_update
status_code
date_of_change
product_category_id
doa_or_nff
current_status_of_job
date_into_sorting
date_out_sorting
date_passed_to_sales
1.
update sorting_temp
set status_update='Y', status_code = 'JJJJ', date_of_change = date_passed_to_sales
where (date_passed_to_sales is not null or date_passed_to_sales != '')
2.
update sorting_temp
set status_update='Y', status_code = 'GGGG', date_of_change = date_out_sorting
where current_status_of_job = 'BER-SCRAPPED' and status_update ='N';
3.
update sorting_temp
set status_update='Y', status_code = 'JJJJ', date_of_change = date_out_sorting
where (doa_or_nff = 'NFF' or doa_or_nff = 'CDNFF')
and (date_out_sorting is not null or date_out_sorting != '')
and status_update ='N';
4.
update sorting_temp
set status_update='Y', status_code = 'EEEE', date_of_change = date_out_sorting,
where doa_or_nff = 'BER' and status_update ='N';
5.
update sorting_temp
set status_update='Y', status_code = 'BBBB', date_of_change = date_into_sorting,
where product_category_id = 'NOT RECEIVED' and status_update ='N';
6.
update sorting_temp
set status_update='Y', status_code = 'DDDD', date_of_change = date_into_sorting,
where doa_or_nff = 'EMPTY BOX' and status_update ='N';