select sample.c1,sample.c2,sample.c3,relate.vl
from sample,relate
where sample.c2=relate.c2(+);如果解决问题了,就去好好地学习学习SQL语句吧

解决方案 »

  1.   

    我用的驱动是sun.jdbc.odbc.JdbcOdbcDriver 不知道有没有关系
      

  2.   

    一个statemen在同一时刻只能执行一个SQL语句,返回一个resultset。如果你要在处理上一个查询结果的同时进行新的查询,需要用两个Statement分别发出查询,分别返回resultset。
      

  3.   

    是的, 提醒的对,我改过之后
    Statement statement1=connection.createStatement();
    ResultSet srs=statement1.executeQuery(sql);Statement statement2=connection.createStatement();
    ResultSet rrs=statement2.executeQuery(sql);出现[Microsoft][ODBC SQL Server Driver]连接占线导致另一个 hstmt
    这个错误
      

  4.   

    SQL中,用左联接,并将V1改名为C2R,即可.
      

  5.   

    tanjun_007(军军) 不懂!能说明白点吗 左联接怎么用?
      

  6.   

    faint!!!!!!!
    若是想修改结果集的话,就不能使用jdbc_odbc桥,因为这样生成的结果集是不可变和不支持滚动光标的,即是你设定createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
    也一样没有用!!!
    使用jdbc驱动吧
      

  7.   

    当然,你使用数据源,即通过jdbc_odbc桥访问数据库,还想修改结果集?
      

  8.   

    一个Statsment对象一次只能查询出一个结果集,如果原来的结果集是打开的,在试图创建第二个结果集时,不能成功,其是关闭的。如果要同时执行两个结果集,则应该创建两个Statsment对象,分别处理。如果不是同时处理,则可以降低一个结果集关闭后产生第二个结果集。下面的是jdk文档对Statsment的描述:
    The object used for executing a static SQL statement and returning the results it produces. By default, only one ResultSet object per Statement object can be open at the same time. Therefore, if the reading of one ResultSet object is interleaved with the reading of another, each must have been generated by different Statement objects. All execution methods in the Statement interface implicitly close a statment's current ResultSet object if an open one exists.