If else in Mysql Update query -


i need query update fields in table based on count of field.

update      bank_sample_map  left join      sample_details on bank_sample_map.sample_track_id = sample_details.sampletrack_id  left join      order_details on order_details.sample_detail_id = sample_details.sample_id  left join      test_details on test_details.test_detail_id = order_details.test_detail_id set      bank_sample_map.sample_id = sample_details.sample_id, bank_sample_map.order_id = order_details.order_number, bank_sample_map.testid = test_details.test_id,bank_sample_map.test_cost = test_details.test_cost       bank_sample_map.sample_id null      , bank_sample_map.order_id null      , bank_sample_map.testid null      , (select count(order_number) < 2  order_details sample_detail_id = sample_details.sample_id); 

if(count(order_number) < 2) need update sample_id,order_id,testid,test_cost else update sample_id only.

how change query satisfy condition.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -