Z
zhanggeye
Unregistered / Unconfirmed
GUEST, unregistred user!
来自:zbz, 时间:2001-12-29 18:00:00, ID:822034 [显示:小字体 | 大字体]
表1
tId flag
1 0
2 0
3 0
表2
table1Id Qty1 Qty2
1 80 80
1 90 85
2 90 90
2 100 100
当在 表1.tid=表2.table1id 时,如果表2.Qty1=表2.Qty2时,将表1的flag设为1
即根据这想法应得出表1的运行结果:
tId flag
1 0
2 1
3 0
来自:zhanggeye, 时间:2001-12-29 18:12:00, ID:822088 | 编辑
update 表1 set flag=1 where tid not in (select tableid from 表2 where qty1<>qty2 group by tableid)
来自:helpmybl, 时间:2001-12-30 9:19:00, ID:823084
试试:
update 表1 set flag='1' where tid in (select table1id from 表2 where qty1=qty2 group by table1id)
来自:zbz, 时间:2001-12-30 10:35:00, ID:823380
接受答案了.
得分大富翁:helpmybl
表1
tId flag
1 0
2 0
3 0
表2
table1Id Qty1 Qty2
1 80 80
1 90 85
2 90 90
2 100 100
当在 表1.tid=表2.table1id 时,如果表2.Qty1=表2.Qty2时,将表1的flag设为1
即根据这想法应得出表1的运行结果:
tId flag
1 0
2 1
3 0
来自:zhanggeye, 时间:2001-12-29 18:12:00, ID:822088 | 编辑
update 表1 set flag=1 where tid not in (select tableid from 表2 where qty1<>qty2 group by tableid)
来自:helpmybl, 时间:2001-12-30 9:19:00, ID:823084
试试:
update 表1 set flag='1' where tid in (select table1id from 表2 where qty1=qty2 group by table1id)
来自:zbz, 时间:2001-12-30 10:35:00, ID:823380
接受答案了.
得分大富翁:helpmybl