Select No1,Name,
IsNull((Select Sum(ml) From juan Where No1=Main.No1),0) As ml
From Main

解决方案 »

  1.   

    SQLServer数据库Select No1,Name,
    IsNull((Select Sum(ml) From juan Where No1=Main.No1),0) As ml
    From Main
    where (Select Sum(ml) From juan Where No1=Main.No1)>0
    and (Select Sum(ml) From juan Where No1=Main.No1)<500
      

  2.   

    SQLServer数据库
    Select No1,Name,
    IsNull((Select Sum(ml) From juan Where No1=Main.No1),0) As ml
    From Main
    where (Select Sum(ml) From juan Where No1=Main.No1)>0
    and (Select Sum(ml) From juan Where No1=Main.No1)<500
      

  3.   

    SQLServer数据库
    Select No1,Name,
    IsNull((Select Sum(ml) From juan Where No1=Main.No1),0) As ml
    From Main
    where (Select Sum(ml) From juan Where No1=Main.No1)>0
    and (Select Sum(ml) From juan Where No1=Main.No1)<500
      

  4.   

                      SQL.Add('SELECT main.no1,main.name,SUM(juan.ml) AS ml ');
                          SQL.Add('From main LEFT JOIN juan ON main.No1=juan.No1 ');
                          SQL.Add('where juan.ml>=:a ');
                          SQL.Add('Group By main.no1,main.name');
                          SQL.Add('order by ml desc');
                          parambyname('a').asinteger:=strtoint(edit1.text);
                      //  parambyname('b').asinteger:=strtoint(edit2.text);
      

  5.   

    SQLServer数据库
    Select No1,Name,
    IsNull((Select Sum(ml) From juan Where No1=Main.No1),0) As ml
    From Main
    where (Select Sum(ml) From juan Where No1=Main.No1)>0
    and (Select Sum(ml) From juan Where No1=Main.No1)<500
    Access数据库
    Select No1,Name,
    Iif((Select Sum(ml) From juan Where No1=Main.No1) is Null,0,(Select Sum(ml) From juan Where No1=Main.No1)) As ml
    From Main
    where (Select Sum(ml) From juan Where No1=Main.No1)>0
    and (Select Sum(ml) From juan Where No1=Main.No1)<500
      

  6.   

    我也没太看出哪里有不对的地方。  你试将SUM(juan.ml) AS ml 后的AS  ml  的ml 换个名试试。