Re: "SUM" of a varchar column?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Aaron [SQL Server MVP] (ten.xoc_at_dnartreb.noraa)
Date: 12/17/04


Date: Fri, 17 Dec 2004 12:17:29 -0500

This looks like a PIVOT. Can you flatten this table out on the client? If
not, see http://www.aspfaq.com/2462

-- 
http://www.aspfaq.com/
(Reverse address to reply.)
"Maury Markowitz" <MauryMarkowitz@discussions.microsoft.com> wrote in
message news:7838E3D4-CD8D-46EB-A75F-D069B30EE9AB@microsoft.com...
> I have a table that contains a number of columns containing either a
varchar
> value, or null. There are multiple rows per grouping. I would like to
colapse
> the multiple rows into a single row, either by appending the strings to
each
> other, or simply selecting the first (or last) one.
>
> If it was a number field I could do a SUM, MAX or MIN. SUM doesn't work,
for
> obvious reasons. I thought MAX would work, but MAX returns only one value
for
> all of the columns (as opposed to one per column) and the rest are left as
> null.
>
> Any suggestions?


Relevant Pages

  • Sum of Cells if Row Contains a Specific Variable
    ... tracking, and need to sum a group of multiple cells in multiple rows, ... I need a formula that will sum the totals from columns B and C, ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Sum of Cells if Row Contains a Specific Variable
    ... tracking, and need to sum a group of multiple cells in multiple rows, ... I need a formula that will sum the totals from columns B and C, ...
    (microsoft.public.excel.worksheet.functions)
  • Re: multiplied results - strange
    ... You are ending up with a Cartesian Product because one or both tables have multiple rows for the value of Quadra. ... you need to sum first and join last and the only way to do that is with nested queries or sub-selects. ... "Luciana Travassos" wrote in ...
    (microsoft.public.access.tablesdbdesign)
  • Re: sum columns into column in same table
    ... First, SUM acts across multiple rows, but you appear to simply be ... consider making it a computed column rather than ...
    (comp.databases.ms-sqlserver)
  • Re: update just the last item in field
    ... Note that if multiple rows are tied for the same "highest number" then this ... will affect multiple rows. ... (Reverse address to reply.) ... "occultbird" wrote in message ...
    (microsoft.public.sqlserver.server)