我要在第一个语句里使用第二条语句里的所有班级????Select tem1.*,tem2.* From (select 担保人,count(担保人) as dbr from (select 担保人 from [2003秋机电一体化(1)班] union all select 担保人 from [2003秋电子电工(1)班]) as tmp group by 担保人)tem1,(select 担保人 from sysobjects where 担保人 in (select 担保人 from syscolumns where 担保人 like '2003秋%'))tem2
   where tem1.担保人=tem2.担保人

解决方案 »

  1.   

    sql="select 担保人,count(担保人) as dbr from (select 担保人 from [2003秋机电一体化(1)班] union all select 担保人 from [2003秋电子电工(1)班]) as temp) sysobjects
    where 担保人 in (select 担保人 from syscolumns where 担保人 like '2003秋%')
    group by 担保人"
      

  2.   

    刚刚多了一个括号
    sql="select 担保人,count(担保人) as dbr from (select 担保人 from [2003秋机电一体化(1)班] union all select 担保人 from [2003秋电子电工(1)班] as temp) sysobjects
    where 担保人 in (select 担保人 from syscolumns where 担保人 like '2003秋%')
    group by 担保人"
      

  3.   

    这样行不行sql="select 担保人,count(担保人) as dbr from sysobjects where 担保人 in (select 担保人 from syscolumns where 担保人 like '2003秋%')
    group by 担保人"