麻烦帮我看下这个查询语句,出错了.
代码如下:
TableName = DatePart( "m ",DateAdd( "m ",-1,Date))
TableNamea = DatePart( "m ",DateAdd( "m ",-2,Date))
sql= "select a.*,b.*,a.phonenumber from pstnuser as a LEFT OUTER JOIN "&TableName& "pstn as b ON a.phonenumber=b.phonenumber where not in(select c.*,d.*,c.phonenumber from pstnuser as c LEFT OUTER JOIN "&TableNamea& "pstn as d ON c.phonenumber=d.phonenumber where d.money IS NULL) and b.money IS NULL "
我用的ACCESS数据库,提示我ODBC不支持所需的属性
------解决方案--------------------有点头晕,不过你的where not in这里,where 和not之间缺东西
------解决方案--------------------应该是sql语句组装的问题
------解决方案--------------------你用了a.*还要用a..phonenumber ??
------解决方案--------------------我也觉得where not 之间差了一个字段名吧??
------解决方案--------------------TableName = DatePart( "m ",DateAdd( "m ",-1,Date))
TableNamea = DatePart( "m ",DateAdd( "m ",-2,Date))
sql= "select a.*,b.*,a.phonenumber from pstnuser as a LEFT OUTER JOIN "&TableName& "pstn as b ON a.phonenumber=b.phonenumber where a.phonenumber not in(select c.*,d.*,c.phonenumber from pstnuser as c LEFT OUTER JOIN "&TableNamea& "pstn as d ON c.phonenumber=d.phonenumber where d.money IS NULL) and b.money IS NULL "