读书人

sql 语法解决方法

发布时间: 2012-03-27 13:44:24 作者: rapoo

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)

读书人网 >Mysql

热点推荐