数据库为access
有两张表,我想取表1 的a字段和表2的 b字段 内容相同的记录和不同的记录SELECT * from filmword as a where a.filmid=3 and  exists(select word from enword as b)SELECT * from filmword as a,enword  as b where a.word=b.word
但 上面写的不对

解决方案 »

  1.   

    --相同的.
    SELECT * from filmword a, enword b where a.filmid = 3 and a.word=b.word --不相同的如何比?怎么显示?一个和多个不同的显示?
      

  2.   

    不相同的
    就是表1的a字段不在表2的b字段存在的记录
    SELECT * from filmword a, enword b where a.filmid = 3 and a.word<>b.word 如果数据很多,这样会很慢
    有没有好的办法解决速度
      

  3.   

    取表1的a字段不在表2的b字段存在的记录的表1的a字段列表
      

  4.   

    --这种查询不可能快.因为一个要和多个不同的去比较.每一条记录都要遍历表.
    SELECT * from filmword where filmid = 3 and word not in (select word from enword)
      

  5.   


     内容相同的记录
    select 表1.*,表2.*
    from 表1,表2
    where 表1.a=表2.b
    不同的记录 select 表1.*,表2.*
    from 表1,表2
    where 表1.a<>表2.b
      

  6.   

    1
    00:01:09,863 --> 00:01:10,921
    Yeah!2
    00:01:10,997 --> 00:01:14,057
    On the 15th of May, in the jungle of Nool,

    1077
    01:18:06,475 --> 01:18:08,443
    I'm just saying words.1078
    01:18:10,412 --> 01:18:12,880
    That felt so good. Cathartic!1079
    01:18:13,648 --> 01:18:14,876
    What?问题是这样的,现在有个问题,一个文件有1000多条记录
    像这个就有1079行
    我要把这些英文单词用空格拆分出来
    然后把每个单词保存倒数据库
    假如数据库有这个单词了,那么不插入现在我只能是循环每个单词执行 insert语句
    但是这样速度超慢
    一个文件都得导入半小时左右
    cpu还占100%
    别的啥也干不成了
    有没有好的办法 解决我这个问题? (access数据库)
      

  7.   

    用一个临时表过渡一下。--step1: 
    insert #tb values(@word)--step2:
    insert tb select distinct word from #tb