select * from 
-->
select distinct code from 

解决方案 »

  1.   


    select distinct * from 表
      

  2.   

    --在查询分析中执行以下语句,测试下返回值是否正确
    select table2.code 
    from table1 INNER join table2 on table1.num = table2.num 
    WHERE table1.num = 1
      

  3.   

    --如果有重复值,加上distinct
    select distinct table2.code
    from table1 INNER join table2 on table1.num = table2.num
    WHERE table1.num = 1
      

  4.   

     哈,问题解决了。原因在于 SQL 语句:
    "select * from table1 INNER join table2 on table1.num = table2.num WHERE (((table1.num)='" & frmZZYQ.txtFields(37).Text & "'))"  原来在设计水晶报表的时候,已经把这些数据关系做在报表中了,我们的 SQL 语句只需写成:
    SELECT * FROM Table1 WHERE table1.num='" & frmZZYQ.txtFields(37).Text &"'写多了反而误事,害我这个菜鸟烦恼了好久,谢谢大家! 
      

  5.   


    对啊,你直接查询table2表就行了