亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 2382 | 回復(fù): 9
打印 上一主題 下一主題

大家?guī)臀铱匆幌逻@個語句為什么會報錯 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2005-07-28 22:56 |只看該作者 |倒序瀏覽
把同一個表中符合某個條件的同一字段的值賦給另外一個元素

update table set table.name=(select table.name from table where 條件) where 條件

論壇徽章:
0
2 [報告]
發(fā)表于 2005-07-29 13:51 |只看該作者

大家?guī)臀铱匆幌逻@個語句為什么會報錯

-360    Cannot modify table or view used in subquery.

The UPDATE, INSERT, or DELETE statement uses data taken from the same table
in a subquery. This action is not allowed because of the danger of getting
into an endless loop. Select the input data into a temporary table first,
and then refer to the temporary table in the UPDATE or INSERT statement.

論壇徽章:
0
3 [報告]
發(fā)表于 2005-07-29 17:54 |只看該作者

大家?guī)臀铱匆幌逻@個語句為什么會報錯

table.name=(select table.name from table where 條件) 這里選出的不是唯一的一條記錄,而是記錄集合

論壇徽章:
0
4 [報告]
發(fā)表于 2005-07-30 20:32 |只看該作者

大家?guī)臀铱匆幌逻@個語句為什么會報錯

做個實驗
一.建兩張測試表test1,test2
  create table test1
  (
    co1 char(1)
  );
  
  create table test2
  (
    co1 char(1)
  );

二.
都插入9條記錄
1|
2|
3|
..
9|

三.實驗:
update test1
set co1=(select co1 from test1 where co1=1)
where co1=5

報錯
360: Cannot modify table or view used in subquery.  
------------------------------
update test1
set co1=(select co1 from test2 where co1=1)
where co1=5
select * from test1;

co1

1  
2
3
4
1
6
7
8
9
說明不是集合的問題,只要注意讓條數(shù)對上就好了
-----------------------------

論壇徽章:
0
5 [報告]
發(fā)表于 2005-07-31 22:15 |只看該作者

大家?guī)臀铱匆幌逻@個語句為什么會報錯

[quote]原帖由 "yyiiasc"]table.name=(select table.name from table where 條件) 這里選出的不是唯一的一條記錄,而是記錄集合[/quote 發(fā)表:

都給了條件,只有一條記錄。

論壇徽章:
0
6 [報告]
發(fā)表于 2005-07-31 22:17 |只看該作者

大家?guī)臀铱匆幌逻@個語句為什么會報錯

原帖由 "twothings" 發(fā)表:
做個實驗
一.建兩張測試表test1,test2
  create table test1
  (
    co1 char(1)
  );
  
  create table test2
  (
    co1 char(1)
  );

二.
都插入9條記錄
1|
2|
3|
..
9|

三.實驗:
..........

你建了兩張表,根據(jù)你的思路用臨時表試一下。

論壇徽章:
0
7 [報告]
發(fā)表于 2005-08-01 13:35 |只看該作者

大家?guī)臀铱匆幌逻@個語句為什么會報錯

原帖由 "twothings" 發(fā)表:
-360    Cannot modify table or view used in subquery.

The UPDATE, INSERT, or DELETE statement uses data taken from the same table
in a subquery. This action is not allowed because of the danger of..........

提示不是寫得很清楚么,不能更改子句中引用的表

論壇徽章:
0
8 [報告]
發(fā)表于 2005-08-02 20:43 |只看該作者

大家?guī)臀铱匆幌逻@個語句為什么會報錯

--------------------------------------------------------------------------------

把同一個表中符合某個條件的同一字段的值賦給另外一個元素

update table set table.name=(select distinct  table.name from table where 條件) where 條件

論壇徽章:
0
9 [報告]
發(fā)表于 2005-08-02 22:36 |只看該作者

大家?guī)臀铱匆幌逻@個語句為什么會報錯

原帖由 "一把火" 發(fā)表:
--------------------------------------------------------------------------------

把同一個表中符合某個條件的同一字段的值賦給另外一個元素

update table set table.name=(select distinct  table.nam..........


不要想當然,你測試了么

論壇徽章:
0
10 [報告]
發(fā)表于 2005-08-03 09:17 |只看該作者

大家?guī)臀铱匆幌逻@個語句為什么會報錯

已經(jīng)用臨時表的方式解決:
select * from table where 條件 into temp ftmp;
update table set table.name=(select name from ftmp)   where 條件;
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP