![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
data_tmp lab_sample_id,conductivity_pS_cm,DO_mg_per_l,pH VM_WR_09_0100_0,76.5,4.15,5.54 VM_WR_09_0100_1,76.6,4.02,5.56 removed_data lab_sample_id,value VM_WR_09_0100_0,76.5 VM_WR_09_0100_0,5.54 VM_WR_09_0100_1,4.02 The statement below lets me accomplish the removal of "removed data" for one column in the data_tmp table but I need this to occur for every column in data_tmp. I'm doing this through a script so I was hoping to do it with one query. I've had some very good ideas come out of this group before so I thought I would give it another shot. Any suggestions would be very much appreciated. UPDATE data_tmp as t1 LEFT JOIN removed_data AS t2 ON t1.lab_sample_id = t2.lab_sample_id SET t1.conductivity_pS_cm = NULL WHERE t1.conductivity_pS_cm = t2.value |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
I'll have a unique WHERE clause for each SET so something like this... UPDATE wr_table_tmp as t1 LEFT JOIN removed_fields_wr AS t2 ON t1.id = t2.id SET t1.conductivity_pS_cm = NULL WHERE t1.conductivity_pS_cm = t2.value; UPDATE wr_table_tmp as t1 LEFT JOIN removed_fields_wr AS t2 ON t1.id = t2.id SET t1.DO_mg_per_l = NULL WHERE t1.DO_mg_per_l = t2.value; This actually works but it is not very elegant. |
#5
| |||
| |||
|
|
I'll have a unique WHERE clause for each SET so something like this... UPDATE wr_table_tmp as t1 LEFT JOIN removed_fields_wr AS t2 ON t1.id = t2.id SET t1.conductivity_pS_cm = NULL WHERE t1.conductivity_pS_cm = t2.value; UPDATE wr_table_tmp as t1 LEFT JOIN removed_fields_wr AS t2 ON t1.id = t2.id SET t1.DO_mg_per_l = NULL WHERE t1.DO_mg_per_l = t2.value; This actually works but it is not very elegant. |
#6
| |||
| |||
|
|
might work. However, update of a left join is not supported in iso/ansi standard and the semantics of this construct is unclear to me. |
![]() |
| Thread Tools | |
| Display Modes | |
| |