网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 服务器与数据库 > MySQL
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

Reply
 
Thread Tools Display Modes
  #1   IP: 58.241.198.25
Old 2012-12-06, 06:10 AM
topvip topvip is offline
超级版主
 
Join Date: 2006-01-04
Posts: 1206
topvip 正向着好的方向发展
Default 在mysql中如何用一个字段的值替换另一个字段的值

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
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 02:09 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.