none
Result value of leftjoin sum RRS feed

  • Question

  •  

     

    Code Snippet

    StringBuilder strSql = new StringBuilder();

    strSql.Append("SELECT ");

    strSql.Append("[Table-AR-INVOICE].[AR-CUSTOMER CODE], ");

    strSql.Append("[Table-AR-INVOICE].[AR-SALES PERSON CODE],");

    strSql.Append("Sum([Table-AR-INVOICE].[AR-GROSS AMT]) AS [Sum01], ");

    strSql.Append("Sum([Table-AR-INVOICE].[AR-GST]) AS [Sum02], ");

    strSql.Append("Sum([Table-AR-INVOICE].[AR-PST]) AS [Sum03], ");

    strSql.Append("Sum([Table-AR-INVOICE].[AR-NET AMOUNT]) AS [Sum04], ");

    strSql.Append("Sum([Table-AR-CASH].[AR-PAYMENT AMOUNT]+[Table-AR-CASH].[AR-PAYMENT DISCOUNT]) AS [Sum05]");

    strSql.Append("FROM [Table-AR-INVOICE]");

    strSql.Append("LEFT JOIN [Table-AR-CASH] ON [Table-AR-INVOICE].[AR-INVOICE NO] = [Table-AR-CASH].[AR-APPLY TO]");

    strSql.Append("GROUP BY [Table-AR-INVOICE].[AR-CUSTOMER CODE], [Table-AR-INVOICE].[AR-SALES PERSON CODE]");

    strSql.Append("HAVING ((([Table-AR-INVOICE].[AR-CUSTOMER CODE])='" + strCode + "')AND ([Table-AR-INVOICE].[AR-SALES PERSON CODE])<>'')");

     

    Sum05 is the result of the left join.

    Where there is no joined record what would the result be.

    I have tried null and zero but both give error.

    I am trying to make it a double.

    Any help would be appreciated.

     

     

    Wednesday, June 20, 2007 3:27 PM

Answers