首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

sql 语法解决方法

2012-03-27 
sql 语法update table2 set id (select id from table2 limit 1)或update table2 set id in (select id

sql 语法
update table2 set id = (select id from table2 limit 1);

update table2 set id in (select id from table2 );


貌似我这样写,语法不对..我要达到上述功能要怎么写?

[解决办法]
python:
UPDATE="update table2 set id = %s"
SELECT="select id from table2 limit 1"
cur.execute(SELECT)
ID=cur.fetchone()
cur.execute(UPDATE,ID)

热点排行