检查VFP数据表中字段值相同的问题

作者在 2015-02-24 11:46:29 发布以下内容

问题网址:http://bbs.bccn.net/thread-442165-1-1.html

* 生成测试数据
create cursor tt1 (记录行 i,字段名 c(10),值 i) && 临时表
create cursor tt (a1 i,a2 i,a3 i,a4 i,a5 i,a6 i,a7 i,a8 i,a9 i,a10 i,a11 i)
for lnI=1 to 11
	append blank
	nzds=0
	for lnJ=(lnI-1)*11+1 to lnI*11
		nzds=nzds+1
		replace (field(nzds)) with lnJ
	endfor
endfor
* 设置相同数据
replace record 1 a7 with 8
replace record 4 a6 with 48
replace record 6 a6 with 48
* 列记录转换为行记录
scan
	scatter to azd
	for lnI=1 to fcount("tt")
		insert into tt1 values (recno("tt"),field(lnI,"tt"),azd[lnI])
	endfor
endscan
* 显示查询结果
select * from tt1 where 值 in (select 值 from tt1 group by 值 having count(*)>1) order by 值

数据表问题 | 阅读 1633 次
文章评论,共0条
游客请输入验证码
浏览376333次