Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 2891|回复: 2

[已解决]★★★ sql 中显示字段动态显示不能列数据

[复制链接]
发表于 2014-8-13 09:21 | 显示全部楼层 |阅读模式
求解答
cnn.Open "provider=microsoft.jet.oledb.4.0;extended properties='excel 8.0;hdr=no';data source=" & strbookname
strsql = "select f1,f2,f10 from [" & strsheetname & "$] where f19>=0 ;"

因为原始表字段存在变化,数据表列f10可能变f11,在sql语句中如何实现通过变量实现f10转变成f11,求高人指点



最佳答案
2014-8-13 09:35
??是这个意思么?
for i =10 to 11
strsql = "select f1,f2,f"& i &" from [" & strsheetname & "$] where f19>=0 ;"
next

发表于 2014-8-13 09:35 | 显示全部楼层    本楼为最佳答案   
??是这个意思么?
for i =10 to 11
strsql = "select f1,f2,f"& i &" from [" & strsheetname & "$] where f19>=0 ;"
next

评分

参与人数 1 +1 收起 理由
huangy007 + 1 赞一个!

查看全部评分

回复

使用道具 举报

 楼主| 发表于 2014-8-13 11:57 | 显示全部楼层
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-3-28 22:40 , Processed in 0.414301 second(s), 13 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表