首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

想把一个sql语句分成两个过程来实现,怎么办

2012-10-18 
想把一个sql语句分成两个过程来实现,怎么处理啊[codeVB][/code]Connsql select distinct xiaoqu_name

想把一个sql语句分成两个过程来实现,怎么处理啊
[code=VB][/code] 
  Conn
  sql = "select distinct xiaoqu_name as 小区名称 from user_data where xiaoqu_name not in(select distinct a.xiaoqu_name from user_data as a inner join readdata as b on a.remote_id=b.remote_id and a.selinfo='" & cmbSelinfo.Text & "' where readtime>'" & DateAdd("d", -6, Date) & "' and readtime < '" & DateAdd("d", 1, Date) & "') and selinfo='" & cmbSelinfo.Text & "' order by xiaoqu_name asc"
  Debug.Print sql
  rs.Open sql, cnn, 1, 1

怎么处理啊。想把这句SQL语句分成两个过程实现

[解决办法]
sql = "select distinct a.xiaoqu_name from user_data as a inner join readdata as b on a.remote_id=b.remote_id and a.selinfo='" & cmbSelinfo.Text & "' where readtime>'" & DateAdd("d", -6, Date) & "' and readtime < '" & DateAdd("d", 1, Date) & "'"

Debug.Print sql

rs.Open sql, cnn, 1, 1

strInSub = rs.GetString(2, , , ",")

sql = select distinct xiaoqu_name as 小区名称 from user_data where xiaoqu_name not in( & strInSub & ") and selinfo='" & cmbSelinfo.Text & "' order by xiaoqu_name asc"

Debug.Print sql

rs.Open sql, cnn, 1, 1

热点排行