update image set image=(select max(pic) from music where title=image.name)
where exists(select 1 from music where title=image.name);

解决方案 »

  1.   

    bzszp(www.bzszp.533.net) ( )
    高实在是高!能不能给我解释一下exists(select 1 from music where title=image.name);
    这在这句话里是什么意思啊?有什么作用!谢了先!
      

  2.   

    防止将没有对应关系的数据更新为null.
      

  3.   

    还有最后一个问题请教:
    在一个表image里更新想把两个字段连接起来写入到地三个字段怎么写啊?
    比如:update  image set image =(select concat(wpp,wppp) from image)  where type= 'pic'
    结果报错!
    麻烦了-----!完了就结!
      

  4.   

    我写的这两句它都说错了!update  wp set  image =select  wpp || wppp from wp  where type = 'pic' 
    update  wp set  image =(select  wpp || wppp  from wp  where type = 'pic' ) where type = 'pic' 
      

  5.   

    max(pic) :
    MAX不是取的是最大值吗??
    怎么会用在这里???
    select max(pic) from music where title=image.name
    ??百思不得其解!!?!?!
      

  6.   

    你写的这两句有问题
    update wp set image=(select wpp ¦¦ wppp from wp where type='pic'  )  
    where  type  =  'pic'  如果select wpp ¦¦ wppp from wp where type='pic'返回多行,将报错 
    看你的意思,应该这样: 
    update wp set image=wpp||wppp where type='pic';