t_Item a join t_Item b 取哪个表中空id字,关键字段是尖id吗? 你这样是表联接而以呀!t_Item a left join t_Item b   取左表(取左表中所有记录,如果右表中没有则以null表示)
t_Item a right join t_Item b  取右表(取右表中所有记录,如果左表中没有则以null表示)
t_Item a full join t_Item b   所有表(取左右表中所有记录,如果左或右表中没有则以null表示)

解决方案 »

  1.   


    是这样的吗?
    select * from t_Item a left join t_Item b on a.id=b.id 
    where a.id is null
      

  2.   

    我有一条: 
    select min(id)+1 from t_Item where id+1 not in(select id from t_Item)
    但是还不太满意
      

  3.   

    是这样的: 表:t_Item (id int not null,
                           name varchar(30) null ,
                           ...
                          )
               数据: 1, 'aa'
                      2,  'bb'
      

  4.   

    是这样的:  表:t_Item  (id  int  not  null,  
                            name  varchar(30)  null  ,  
                            )  
                数据:  1,  'aa'  
                        2,   'bb' 
                        4,   'cc'
                        6,   'dd'  需要求表t_Item中id字段的空号:3,5的值,以便插入