数据库

img keminlau

SQL工作记录

发表于2004/11/3 21:31:00  1035人阅读

分类: 技术_应用开发_数据库

两张表是一样的,只是新老数据更新
update dbo.classmates
set LoginTimes = (select LoginTimes from dbo.classmates2 where classmates.id = classmates2.id )

select 输出格式化(分支判断)注意字串用单引号
select name 名字, (case when sex=1 then '男' else '女' end)性别 from classmates

联接(二表)更新

update charge_mst
set receipt = receipt - k.allDot
from charge_mst as c,kao600099 as k
where k.inuser = c.userid


把“回复表”里的回复时更表到“留言表”里去(置疑)
UPDATE guestbook INNER JOIN Reply ON guestbook.PostID = Reply.PostID SET guestbook.dtLastReply = Reply.ReplyTime
WHERE [Reply].[PostId] =[guestbook].[PostId]

复制表
select * into b from a

拷贝表
insert into b(a, b, c) select d, e, f from b

阅读全文
0 0

相关文章推荐

img
取 消
img