功能:实现将表result_good_city_dzl中的字段lat更新为表 result_good_city_lh中的lat,条件是两个表中的id一样 即: update result_good_city_dzl a set a.lat=(select lat from result_good_city_lh b where a.id=b.id and b.lat!=0) DELIMITER $$DROP PROCEDURE IF EXISTS update_result_good_city_…
作为示例,我们在这里使用名为testdb的数据库,并且在其中创建两张一模一样的表: drop table if exists test_table_1; create table test_table_1 ( name varchar(30) primary key, age integer ); drop table if exists test_table_2; create table test_table_2 ( name varchar(30) primary key, age int…
(一) 将数字替换成汉字 第一步,去重查询 使用distinct关键字先对该字段值进行去重查询,看共有几种情况 --查询指定区间内表停诊字段的值 SELECT DISTINCT T.CLOSE_TZ FROM CONSULT_SCHEDULE T WHERE T.SCHEDULE_DATE BETWEEN TO_DATE('2018-01-01', 'yyyy-MM-dd') AND TO_DATE('2018-02-28', 'yyyy-MM-dd'); 查询结果:共有3种情况 第二步,区…