二 SQL题
表 g_cardapply
字段
G_applyno int 编号 关键字
G_applydate bigint 申请时间
G_state varchar 状态表 g_cardapplydetail
字段
G_applyno int 编号 关键字
G_idcard varchar 身份证
G_applyname varchar 姓名
G_state varchar 状态3、 将所有身份证号是4403140101082 的状态修改成07 `两个表的状态字段同时修改 用一句SQL语句
表 g_cardapply
字段
G_applyno int 编号 关键字
G_applydate bigint 申请时间
G_state varchar 状态表 g_cardapplydetail
字段
G_applyno int 编号 关键字
G_idcard varchar 身份证
G_applyname varchar 姓名
G_state varchar 状态3、 将所有身份证号是4403140101082 的状态修改成07 `两个表的状态字段同时修改 用一句SQL语句
解决方案 »
- 虚拟主机上,一台机器可以有几百个mysql数据库,是每个数据库都启动单独的服务,还是只启动一个服务呀?
- 当前有谁在用POSTGRESQL的进来报个到
- mysql5.0使用游标时后面的sql语句是生态拼成的,如何实现?
- 怪事?刚插入的mysql数据重启windows2003后就没有了?
- 在C中获取Mysql存储过程的数据集
- 一个跨表查询的问题
- C#如何调用MySQL的执行存储过程
- 租来的空间 mssql 删表的时候说是日志已满,请问我可以删除吗?
- 求一句SQL语句!
- 使用left.right等,返回BLOB是怎么回事?
- 有没有工具可以把整个MSSQL数据库转为MySql数据库
- mysql数据库中怎样实现,若表中不存在某个字段,就添加一个字段?
set a.G_state='07',b.G_state='07' where b.G_idcard='07'
set a.G_state='07,b.G_state='07'
where b.G_idcard='4403140101082'
mysql> select * from B;
+------+------+--------+
| name | id | status |
+------+------+--------+
| asd | 1 | 7 |
+------+------+--------+
1 row in set (0.00 sec)mysql> select * from A;
+------+--------+
| name | status |
+------+--------+
| asd | 7 |
+------+--------+
1 row in set (0.00 sec)mysql> update A join B on A.name=B.name set A.status=08,B.status=08 where B.id=1;
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2 Changed: 2 Warnings: 0mysql> select * from A;
+------+--------+
| name | status |
+------+--------+
| asd | 8 |
+------+--------+
1 row in set (0.00 sec)mysql> select * from B;
+------+------+--------+
| name | id | status |
+------+------+--------+
| asd | 1 | 8 |
+------+------+--------+
1 row in set (0.00 sec)
127.0.0.1~root@localhost~test>select * from t1;
+------+------+
| a | b |
+------+------+
| 1 | 2 |
| 2 | 3 |
| 3 | 4 |
| 4 | 6 |
+------+------+
4 rows in set (0.05 sec)127.0.0.1~root@localhost~test>select * from t2;
+----+-----+-------+
| id | id1 | sname |
+----+-----+-------+
| 1 | 1 | a |
| 3 | 2 | a |
| 4 | 3 | a |
| 8 | 4 | a |
+----+-----+-------+
4 rows in set (0.03 sec)
127.0.0.1~root@localhost~test>update t1,t2 set t1.b=10,t2.id1=10 where t1.a=t2.id and t1.a=1;
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2 Changed: 2 Warnings: 0127.0.0.1~root@localhost~test>select * from t1;
+------+------+
| a | b |
+------+------+
| 1 | 10 |
| 2 | 3 |
| 3 | 4 |
| 4 | 6 |
+------+------+
4 rows in set (0.00 sec)127.0.0.1~root@localhost~test>select * from t2;
+----+-----+-------+
| id | id1 | sname |
+----+-----+-------+
| 3 | 2 | a |
| 4 | 3 | a |
| 8 | 4 | a |
| 1 | 10 | a |
+----+-----+-------+
4 rows in set (0.00 sec)127.0.0.1~root@localhost~test>