Aggregate two fields

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • carrionk@yahoo.com

    Aggregate two fields

    Hi,
    I have the Following Table [SALES]:

    Month Quantity1 Quantity2
    Jan 100 150
    Feb 500 100
    Mar 100 0

    I need a query that can Aggregate Quantity1 and Quantity2, so I can
    get:

    Month [Quantity1+Quant ity2]
    Jan 250
    Feb 600
    Mar 100

    SELECT Month, [Quantity1+Quant ity2] as TOTAL FROM SALES
    .... is this Query is OK? I get A blank result

    Regards
    LC

  • pietlinden@hotmail.com

    #2
    Re: Aggregate two fields

    how about
    SELECT Month, Quantity1 + Quantity2 As TOTAL
    FROM Sales;

    Comment

    • jr

      #3
      Re: Aggregate two fields

      This is how it works if using Access 97 2000 2002 xp

      SELECT Month, [Quantity1]+[Quantity2] as TOTAL FROM SALES
      .... is this Query is OK? I get A blank result

      SELECT Month, [Quantity1+Quant ity2] as TOTAL FROM SALES
      .... is this Query is OK? I get A blank result

      <carrionk@yahoo .com> wrote in message
      news:1122137793 .564261.272080@ g47g2000cwa.goo glegroups.com.. .[color=blue]
      > Hi,
      > I have the Following Table [SALES]:
      >
      > Month Quantity1 Quantity2
      > Jan 100 150
      > Feb 500 100
      > Mar 100 0
      >
      > I need a query that can Aggregate Quantity1 and Quantity2, so I can
      > get:
      >
      > Month [Quantity1+Quant ity2]
      > Jan 250
      > Feb 600
      > Mar 100
      >
      > SELECT Month, [Quantity1+Quant ity2] as TOTAL FROM SALES
      > ... is this Query is OK? I get A blank result
      >
      > Regards
      > LC
      >[/color]


      Comment

      • Ronald Roberts

        #4
        Re: Aggregate two fields

        This works for a table I have.
        SELECT Payments.PY_Pay Date, [PY_CourseAmtPai d]+[PY_TextAmtPaid] _
        AS Total FROM Payments;

        The only thing I can see is month is a reserved word and and the
        ; at the end you may need to say:

        SELECT Sales.Month, [Quantity1+Quant ity2] as TOTAL FROM SALES;

        HTH
        Ron


        jr wrote:[color=blue]
        > This is how it works if using Access 97 2000 2002 xp
        >
        > SELECT Month, [Quantity1]+[Quantity2] as TOTAL FROM SALES
        > ... is this Query is OK? I get A blank result
        >
        > SELECT Month, [Quantity1+Quant ity2] as TOTAL FROM SALES
        > ... is this Query is OK? I get A blank result
        >
        > <carrionk@yahoo .com> wrote in message
        > news:1122137793 .564261.272080@ g47g2000cwa.goo glegroups.com.. .
        >[color=green]
        >>Hi,
        >>I have the Following Table [SALES]:
        >>
        >>Month Quantity1 Quantity2
        >>Jan 100 150
        >>Feb 500 100
        >>Mar 100 0
        >>
        >>I need a query that can Aggregate Quantity1 and Quantity2, so I can
        >>get:
        >>
        >>Month [Quantity1+Quant ity2]
        >>Jan 250
        >>Feb 600
        >>Mar 100
        >>
        >>SELECT Month, [Quantity1+Quant ity2] as TOTAL FROM SALES
        >>... is this Query is OK? I get A blank result
        >>
        >>Regards
        >>LC
        >>[/color]
        >
        >
        >[/color]

        Comment

        Working...