看了一下,不知道楼主是不是这个意思:
select sum(Score) as ka from RecordDrawScore where DrawID in (select KindID from GameScoreInfo where  KindID > 2000)

解决方案 »

  1.   

    select * from A inner join B on A.id=B.id where A.id>2000
      

  2.   

    select sum(A.Score) as ka from RecordDrawScore as A
    inner join  GameScoreInfo  as B on A.DrawID = B.DrawID
    where B.KindID > 2000 
      

  3.   

    还是不行呢,表是这样的,
    majiangrint = 0;
                majiangrint1 = 0;
                DataTable m_mdt = myData.GetDataTable("select sum(A.Score) as ka from RecordDrawScore as A inner join  GameScoreInfo  as B on A.DrawID = B.DrawID where B.KindID > 2000   and userID=(select UserID from QPAccountsDB.dbo.AccountsInfo where Accounts='" +id + "') and [InsertTime] >= '" + d1 + "  12:00:00' and [InsertTime] <= '" + d2 + "  12:00:00'");
                if (m_mdt != null)
      

  4.   

     
     
    我想查询RecordDrawScore  Score的和,条件是要GameScoreInfo里DrawID对应的KindID 的值必须大于2000的才进入求和计算
      

  5.   


    select sum(Score) as ka from RecordDrawScore where DrawID in (select DrawID from GameScoreInfo where  KindID > 2000)
      

  6.   

    还是不行啊,原来代码是这样的DataTable m_mdt = myData.GetDataTable("select sum(Score) as ka from RecordDrawScore where ChairID!='0' and UserID=(select UserID from QPAccountsDB.dbo.AccountsInfo where Accounts='" +id + "') and [InsertTime] >= '" + d1 + "  12:00:00' and [InsertTime] <= '" + d2 + "  12:00:00'"); 以ChairID作为条件之一,能查询出来,现在ChairID不能用了,需要用另一个表(GameScoreInfo )里的 KindID 作为条件。大神些再帮忙看看!