test4.txt 1.32 KB
select count(*) from bsth_c_s_ttinfo_detail

select * from bsth_c_s_ttinfo_detail

select * from bsth_c_s_ttinfo_detail where zdz_code is null;

select * from bsth_c_station;

select * from bsth_c_car_park;

update bsth_c_s_ttinfo_detail a
set a.qdz_code = (select station_cod from bsth_c_station b where a.qdz = b.id)
where a.bc_type <> 'out'

update bsth_c_s_ttinfo_detail a
set a.qdz_name = (select station_name from bsth_c_station b where a.qdz = b.id)
where a.bc_type <> 'out'

update bsth_c_s_ttinfo_detail a
set a.zdz_code = (select station_cod from bsth_c_station b where a.zdz = b.id)
where a.bc_type <> 'in'

update bsth_c_s_ttinfo_detail a
set a.zdz_name = (select station_name from bsth_c_station b where a.zdz = b.id)
where a.bc_type <> 'in'

update bsth_c_s_ttinfo_detail a
set a.qdz_code = (select park_code from bsth_c_car_park b where a.tcc = b.id)
where a.bc_type = 'out'

update bsth_c_s_ttinfo_detail a
set a.qdz_name = (select park_name from bsth_c_car_park b where a.tcc = b.id)
where a.bc_type = 'out'

update bsth_c_s_ttinfo_detail a
set a.zdz_code = (select park_code from bsth_c_car_park b where a.tcc = b.id)
where a.bc_type = 'in'

update bsth_c_s_ttinfo_detail a
set a.zdz_name = (select park_name from bsth_c_car_park b where a.tcc = b.id)
where a.bc_type = 'in'

commit;