select id,count(*) as allcount from (select * from t1 union select * from t2), a where a.score>=80 group by a.id
—————————————————————————————————
MaximStr := '宠辱不惊,看庭前花开花落,去留无意;
             毁誉由人,望天上云卷云舒,聚散任风。';
if Not Assigned(I) then
  I := TI.Create(Nil);
I.Maxim := MaximStr;
I.Explain := '假如上述代码中出现“OA”、“3D”等字样,改为“=”或者去掉';
I.Desire := '加不加分随你';
—————————————————————————————————
       

解决方案 »

  1.   

    tp  lxpbuaa(桂枝香在故国晚秋)select id,count(*) as allcount from (select * from t1 union select * from t2), a where a.score>=80 group by a.id我直接加到tquery的sql属性中,还是不好用啊
      

  2.   

    'select id,count(*) as allcount from (select * from t1 union select * from t2), a where a.score>=80 group by a.id'这一句就是所有的具体代码了加了三个控件:
    tdatasource它的datasource属性是tquery1
    tquery的sql属性是上面这段sql语句
    tdbgrid的datasource属性是tdatasource1
    表的结构
    t1表结构:id是int非自动增长
    score是int
    t2表结构也一样