Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

SQL: The SUM of Multiple Columns

Explorer ,
Oct 17, 2007 Oct 17, 2007
Can someone please tell me how to SUM mulitple columns using SQL.

I know that this will sum 2 columns:

SELECT
SUM(billing.space_cost) + SUM(billing.pub_box)
FROM billing

and thought that this would do more, but it does not seem to work:

SELECT
(SUM(billing.space_cost) + SUM(billing.pub_box) + SUM(billing.messenger))
FROM billing

Anyone know this one?
TOPICS
Server side applications
447
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 18, 2007 Oct 18, 2007
LATEST
This should work fine. The syntax you provide will certainly SUM these 3
columns ok, providing they are numeric.

Pat.

"VernMan" <webforumsuser@macromedia.com> wrote in message
news:ff5cc5$n8h$1@forums.macromedia.com...
> Can someone please tell me how to SUM mulitple columns using SQL.
>
> I know that this will sum 2 columns:
>
> SELECT
> SUM(billing.space_cost) + SUM(billing.pub_box)
> FROM billing
>
> and thought that this would do more, but it does not seem to work:
>
> SELECT
> (SUM(billing.space_cost) + SUM(billing.pub_box) + SUM(billing.messenger))
> FROM billing
>
> Anyone know this one?
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines