我的想法是这样的:我从一个表中,依据某些查询条件(某字段=某值,各字段之间用and 或or联系起来)并选取部分字段组成一个新表。我用的是这个语句
select field1,field2,field3 into new_table from old_table where condition
但是现在我出现了一个错误,就是,我在condition中依据的字段如果和前面select的字段重复的话,就会提示说“不能重复定义字段”的错误,是这个语句不能用where语句吗?
如果不可以直接用的话,我该怎么解决呢?我想了一个解决方法:
select * from old_table where condition
然后我再从这里选择我要选取的字段,但是这个时候我是从记录集中选取字段
select field1,field2,field3 from ??,这个地方应该怎么写呢?
我挺着急,麻烦大家帮我看看,或者有别的主意帮我提出来!
select field1,field2,field3 into new_table from old_table where condition
但是现在我出现了一个错误,就是,我在condition中依据的字段如果和前面select的字段重复的话,就会提示说“不能重复定义字段”的错误,是这个语句不能用where语句吗?
如果不可以直接用的话,我该怎么解决呢?我想了一个解决方法:
select * from old_table where condition
然后我再从这里选择我要选取的字段,但是这个时候我是从记录集中选取字段
select field1,field2,field3 from ??,这个地方应该怎么写呢?
我挺着急,麻烦大家帮我看看,或者有别的主意帮我提出来!
那格是这么写的
select * from oldtable where condition
select field1,field2,field3 into new_table from old_table where field1='...' and
field2='...'
没有问题old_table有12个字段,生成的new_table有3个字段,可以生成没有记录的表
进行一下测试
'msysobjects是Access2000的系统对象表
if rs.eof then
'不存在
else
'存在
end if