SELECT (iif((select count(*) from b105p where a.jnumber=jnumber and a.contype=contype)=1,1,
(select count(*) from b105p where a.jnumber=jnumber and a.contype=contype and a.id>id)+1)) AS typeid, *
FROM b105p AS a; 作者: kevinch 时间: 2006-4-27 23:37
谢谢4w的帮忙,我很菜的,还是不怎么明白,我上传个原表1,你帮帮忙弄个表2出来吧.
好人做到底.谢谢啦.[attach]17434[/attach] 作者: 一点通 时间: 2006-4-27 23:48
将下面的语句直接复制到新建的查询中
SELECT (IIf((select count(*) from table1 where a.jnumber=jnumber and a.contype=contype)=1,1,(select count(*) from table1 where a.jnumber=jnumber and a.contype=contype and a.id>id)+1)) AS typeid, * INTO table2
FROM table1 AS a; 作者: wwwwa 时间: 2006-4-27 23:49
在查询中输入SQL代码:
SELECT (iif((select count(*) from table1 where a.jnumber=jnumber and a.contype=contype)=1,1,
(select count(*) from table1 where a.jnumber=jnumber and a.contype=contype and a.id>id)+1)) AS typeid, *
FROM table1 AS a;
作者: wwwwa 时间: 2006-4-27 23:51
SELECT (iif((select count(*) from table1 where a.jnumber=jnumber and a.contype=contype)=1,1,
(select count(*) from table1 where a.jnumber=jnumber and a.contype=contype and a.id>id)+1)) AS typeid, * into newtable
FROM table1 AS a 作者: kevinch 时间: 2006-4-27 23:52
终于搞定,谢谢两位大师的帮忙.谢谢!谢谢!谢谢!作者: kevinch 时间: 2006-4-28 00:01
能否解释一下这条sql语句?看不明白.