有一张A表  字段 
create table A{
    id int 
  name varchar(20)

B表  
create table B{
   bid varchar(20)---与A表ID关联}
insert into value B('2','5','8') 此处采用params方式插入无错误。
求根据B.bid对应的A表name值

解决方案 »

  1.   

    select a.name,a.id from A a join B b on b.bid = a.id 
      

  2.   

     不管是不是left join 很明显、这会报语法错误的啊、
      

  3.   

    select a.name from a,b where b.id=a.id
      

  4.   


    呵呵没注意类型,不好意思, 用cast或者convert转换一下应该就行了吧
      

  5.   

    有个前提,你b表中的数据得保证都是可以转化为int类型的数据才可以。
      

  6.   

    我试了一下A 中(1 a,2 b, 3 c)B中(1,2,3)  直接联合查询木有问题,bid中要是有字母的时候才会报转换的错误
      

  7.   

     A中的id是int型、例如 1,2,3 B中的值是 '2','5','8' 联合查询是有语法错误的
      

  8.   

    select a.name,a.id from A a inner join B b on to_number(b.bid) = a.idoracle 的,没有试