两个简单的sql语句的问题(20分)

  • 主题发起人 主题发起人 study2003
  • 开始时间 开始时间
S

study2003

Unregistered / Unconfirmed
GUEST, unregistred user!
一。
singer 表 musicml表
bj name bj,fullname, singerbj
1. 刘德华 1,我的文档/刘德华
想把musicml表的singer设为singer表的bj
我用update
update musicml
set musicml.singerbj=singerbj.bj
where singer.name like '%musicml.fullname%'//请问like后面的该怎么写
二。
musicml 表
bj bfbj singerbj
1 1
2 1
3 1
我想把singerbj设为他的bj和bfbj一样的singerbj。就是上面2,3的singerbj和1的一样,
都为1。
UPDATE MusicMl
SET singerbj = singerbj
WHERE (bfbj = bj)//也不行的,请问该怎么写。
 
请帮满一下
 
高手救命啊
 
用一句SQL不能实现你的功能,我是不会,我踢一下
 
不会那么复杂巴,
给个思路巴
 
是什么数据库啊,不同的数据库Update语法是不同的啊
 
1、
update musicml
set singerbj=singer.bj
from singer
where musicml.fullname like '%'+singer.name+'%'

2、
update musicml
set singerbj=AAA.singerbj
from (select * from musicml) AAA
where musicml.bfbj=AAA.bj

 
你这都些什么SQL语句啊,问题也乱,搞不明白,下次拜托写的明白点
按我的理解可能是下面的:
1.
update musicml
set musicml.singerbj=singerbj.bj
where singer.name=musicml.fullname
2.
实在搞不懂你要做什么,但可提的建议是,大多数复杂的SQL语句是由于数据结构的不合理
造成的,如果语句太复杂请再检查一下你的数据结构是否合理
 
后退
顶部