zgfp.net
当前位置:首页 >> SQL语句实现表中字段A,B,C 根据这个组合查询重复... >>

SQL语句实现表中字段A,B,C 根据这个组合查询重复...

select a,b,c,count(*) as 重复记录 from 表 group by a,b,c

update 表名 set 字段名=right(cast('000000' as nvarchar) +cast(字段名 as nvarchar),6) 需要使用cast函数将前缀的几个0和字段里的值转换成字符串类型,否则会进行数值型的数学相加,而不是将两个字符串连接到一起 如果对您有帮助,请记得采纳...

select min(a),b,c from A表 group by b,c 或者 select max(a),b,c from A表 group by b,c

select id from b join a on b.id=a.a or b.id=a.b or b.id=a.c or b.id=a.d

insert into 表B (a,b,c)select a,b,getdate() from 表A

update 表2 set C字段='核销',D字段=getdate() from 表1,表2 where 表1.A字段=表2.B字段

select (case when a>b then a else b end), (case when b>c then b esle c end) from table_name

我就不看你代码了,我写一段代码给你个思路吧。 set rs=server.createobject("adodb.recordset") sql="select * from 表A where id="id(ID替换掉你查询的条件) rs.open sql,conn '先查询出来A表中的这个人 set rs2=server.createobject("adodb...

1.select * from (select c.*,rownum as rn from (select * from t order by c desc) c) where rn between 21 and 30; 2.select * from (select * from test order by c desc) x where rownum < 30 minus select * from (select * from test ord...

假设表1名为:table1 表2为:table2 表3为:table3 select a.plan,a.unit,b.plan,b.unit,c.URL into new_table from table1 a left join table2 b on a.mark=b.mark left join table3 c on c.URL=b.mark 试试行不行

网站首页 | 网站地图
All rights reserved Powered by www.zgfp.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com