update问题
现有数据库中有三张表table1, table2, table3
模式:
table1( id, col11, col12) (其中id为主键, 所有列都为int型)
table2( id, col21, col22, col23)(其中id为主键, 所有列都为int型)
ta( table_name, colname, keyword, value)
table_name存放着数据库中的表名(只可能为table1或table2)。 colname存放着table_name表的列名(除主键id外)。 keyword为该表中的主键值。 value为表名table_name的值的表中,主键值为keyword的记录的colname列的值
数据:
table1:
id col11 col12
1 2 3
table2:
id col21 col22 col23
2 4 1 5
ta
table_name colname keyword value
table1 col11 1 null
table1 col12 2 null
table2 col21 2 null
table2 col22 2 null
table2 col23 2 null
要求:按要求更新value的值。
说明:table1表的列和table2表的列是预先不知道的(即table1表可能还有col13, col14等, table2表亦然)。