![]() |
|
|||||||
![]() |
|
|
Thread Tools | Display Modes |
|
#1
IP: 58.241.198.25
|
|||
|
|||
|
Q: 在同一个数据库中,先判断表A中的AID是否等于表B中的BID,如果是就用表A中的AC1的值去替换表B中的BC1的值。数据库为MYSQL,在PHPMYADMIN中操作,请问SQL命令该怎么写啊?
update b set bc1 = ( select ac1 from a where a.aid = b.bid)where exists (select 1 from ac1 where a.aid = b.bid) ========================== update b set b.bid=a.ac1 where a.aid=b.bid |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|