国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > 綜合 > 正文

兩表(多表)關(guān)聯(lián)update的寫法

2024-07-21 02:32:23
字體:
供稿:網(wǎng)友

今天凌晨因?yàn)橐跀?shù)據(jù)庫里做一些操作,是關(guān)于兩表關(guān)聯(lián)的update,但語句怎么寫都不正確,老是報(bào)錯(cuò),于是心驚肉跳(就怕不能及時(shí)完成操作)去查了一下,NND,原來把SQL寫成了在SQL Server下面的特有形式,這種語法在Oracle下面是行不通的,急忙改回來,及時(shí)完成了任務(wù)。順便也把查到的SQL帖出來,哪天再忘記了,也好在這里找回來:

   update customers a
   set    city_name=(select b.city_name from tmp_cust_city b where b.customer_id=a.customer_id)
   where  exists (select 1
                  from   tmp_cust_city b
                  where  b.customer_id=a.customer_id
                 )

   -- update 超過2個(gè)值
   update customers a 
   set    (city_name,customer_type)=(select b.city_name,b.customer_type
                                     from   tmp_cust_city b
                                     where  b.customer_id=a.customer_id)
   where  exists (select 1
                  from   tmp_cust_city b
                  where  b.customer_id=a.customer_id
                 )


發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 健康| 大丰市| 岗巴县| 措美县| 西藏| 纳雍县| 休宁县| 建始县| 陵川县| 永善县| 民丰县| 谢通门县| 焦作市| 宜川县| 剑川县| 云阳县| 墨脱县| 玉树县| 汾西县| 息烽县| 荆门市| 巴林左旗| 三江| 枣庄市| 柘荣县| 庄浪县| 明星| 耒阳市| 西藏| 彭州市| 白城市| 石景山区| 卓资县| 乐平市| 巴林左旗| 景宁| 额济纳旗| 云龙县| 开江县| 新宾| 山西省|