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?
Here's an example...
The table contains this data, all items are varchar
32611317
3261Non-Client
32612
3261mmarkowitz
I'd like to turn this into...
3261 1317 Non-client 2 mmarkowitz
|||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?
|||"Maury Markowitz" <MauryMarkowitz@.discussions.microsoft.com> wrote in
message news:DD2FA7A5-A0F2-4BFF-85E9-42533F4E423C@.microsoft.com...
> Here's an example...
> The table contains this data, all items are varchar
>
> 3261 1317
> 3261 Non-Client
> 3261 2
> 3261 mmarkowitz
> I'd like to turn this into...
> 3261 1317 Non-client 2 mmarkowitz
I'm not sure if this will help, but you may want to take a look at the
GROUP BY WITH ROLLUP and WITH CUBE commands. It may work for what you are
after.
SELECT Col1, Max(Col2)
FROM tablename
GROUP BY Col1
WITH ROLLUP
HTH
Rick Sawtell
MCT, MCSD, MCDBA
|||SELECT col1, MAX(col2), MAX(col3), MAX(col4), ...
FROM YourTable
GROUP BY col1
David Portas
SQL Server MVP
|||I don't think this will work, he wants to flatten one ofthe two columns in
his table out into multiple columns...
http://www.aspfaq.com/
(Reverse address to reply.)
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1103306604.369012.58920@.z14g2000cwz.googlegro ups.com...
> SELECT col1, MAX(col2), MAX(col3), MAX(col4), ...
> FROM YourTable
> GROUP BY col1
> --
> David Portas
> SQL Server MVP
> --
>
|||OK. Looks to me like 5 columns but I guess that's just presentational ;-)
Tough to pivot without an explicit attribute for the column.
David Portas
SQL Server MVP
|||"Aaron [SQL Server MVP]" wrote:
> This looks like a PIVOT.
Actually it is the RESULT of a pivot, which is why it is spread out
vertically like that.
But I did figure out a "trick". After reading the page you sent, I combined
their technique of ISNULL (instead of CASE) with MIN, and presto.
Thanks!
(anyone interested in the code?)
Showing posts with label sum. Show all posts
Showing posts with label sum. Show all posts
Friday, March 16, 2012
"SUM" of a varchar column?
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?Here's an example...
The table contains this data, all items are varchar
3261 1317
3261 Non-Client
3261 2
3261 mmarkowitz
I'd like to turn this into...
3261 1317 Non-client 2 mmarkowitz|||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?|||"Maury Markowitz" <MauryMarkowitz@.discussions.microsoft.com> wrote in
message news:DD2FA7A5-A0F2-4BFF-85E9-42533F4E423C@.microsoft.com...
> Here's an example...
> The table contains this data, all items are varchar
>
> 3261 1317
> 3261 Non-Client
> 3261 2
> 3261 mmarkowitz
> I'd like to turn this into...
> 3261 1317 Non-client 2 mmarkowitz
I'm not sure if this will help, but you may want to take a look at the
GROUP BY WITH ROLLUP and WITH CUBE commands. It may work for what you are
after.
SELECT Col1, Max(Col2)
FROM tablename
GROUP BY Col1
WITH ROLLUP
HTH
Rick Sawtell
MCT, MCSD, MCDBA|||SELECT col1, MAX(col2), MAX(col3), MAX(col4), ...
FROM YourTable
GROUP BY col1
--
David Portas
SQL Server MVP
--|||I don't think this will work, he wants to flatten one ofthe two columns in
his table out into multiple columns...
--
http://www.aspfaq.com/
(Reverse address to reply.)
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1103306604.369012.58920@.z14g2000cwz.googlegroups.com...
> SELECT col1, MAX(col2), MAX(col3), MAX(col4), ...
> FROM YourTable
> GROUP BY col1
> --
> David Portas
> SQL Server MVP
> --
>|||OK. Looks to me like 5 columns but I guess that's just presentational ;-)
Tough to pivot without an explicit attribute for the column.
--
David Portas
SQL Server MVP
--|||"Aaron [SQL Server MVP]" wrote:
> This looks like a PIVOT.
Actually it is the RESULT of a pivot, which is why it is spread out
vertically like that.
But I did figure out a "trick". After reading the page you sent, I combined
their technique of ISNULL (instead of CASE) with MIN, and presto.
Thanks!
(anyone interested in the code?)
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?Here's an example...
The table contains this data, all items are varchar
3261 1317
3261 Non-Client
3261 2
3261 mmarkowitz
I'd like to turn this into...
3261 1317 Non-client 2 mmarkowitz|||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?|||"Maury Markowitz" <MauryMarkowitz@.discussions.microsoft.com> wrote in
message news:DD2FA7A5-A0F2-4BFF-85E9-42533F4E423C@.microsoft.com...
> Here's an example...
> The table contains this data, all items are varchar
>
> 3261 1317
> 3261 Non-Client
> 3261 2
> 3261 mmarkowitz
> I'd like to turn this into...
> 3261 1317 Non-client 2 mmarkowitz
I'm not sure if this will help, but you may want to take a look at the
GROUP BY WITH ROLLUP and WITH CUBE commands. It may work for what you are
after.
SELECT Col1, Max(Col2)
FROM tablename
GROUP BY Col1
WITH ROLLUP
HTH
Rick Sawtell
MCT, MCSD, MCDBA|||SELECT col1, MAX(col2), MAX(col3), MAX(col4), ...
FROM YourTable
GROUP BY col1
--
David Portas
SQL Server MVP
--|||I don't think this will work, he wants to flatten one ofthe two columns in
his table out into multiple columns...
--
http://www.aspfaq.com/
(Reverse address to reply.)
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1103306604.369012.58920@.z14g2000cwz.googlegroups.com...
> SELECT col1, MAX(col2), MAX(col3), MAX(col4), ...
> FROM YourTable
> GROUP BY col1
> --
> David Portas
> SQL Server MVP
> --
>|||OK. Looks to me like 5 columns but I guess that's just presentational ;-)
Tough to pivot without an explicit attribute for the column.
--
David Portas
SQL Server MVP
--|||"Aaron [SQL Server MVP]" wrote:
> This looks like a PIVOT.
Actually it is the RESULT of a pivot, which is why it is spread out
vertically like that.
But I did figure out a "trick". After reading the page you sent, I combined
their technique of ISNULL (instead of CASE) with MIN, and presto.
Thanks!
(anyone interested in the code?)
Saturday, February 25, 2012
"mean" quesiton
Hi,
I am trying to find if there is already a function something like "SUM" that
can do a "MEAN". Average is too misleading for getting the "MEAN" order
amount.
Open for suggestions.
Thanks in advance.
George CollinsIsn't mean just a synonym for average? Are you referring to the median?
If so, you could try this post by Celko:
http://groups.google.com/groups?hl=en&lr=&c2coff=1&selm=c0d87ec0.0210170857.72734e7c%40posting.google.com
--
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"george collins" <george@.nospan.com> wrote in message
news:%23I%23aj1GuEHA.1048@.tk2msftngp13.phx.gbl...
> Hi,
> I am trying to find if there is already a function something like "SUM"
that
> can do a "MEAN". Average is too misleading for getting the "MEAN" order
> amount.
> Open for suggestions.
> Thanks in advance.
> George Collins
>|||AVG = mean. Are you referring to median?
--
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
"george collins" <george@.nospan.com> wrote in message
news:%23I%23aj1GuEHA.1048@.tk2msftngp13.phx.gbl...
Hi,
I am trying to find if there is already a function something like "SUM" that
can do a "MEAN". Average is too misleading for getting the "MEAN" order
amount.
Open for suggestions.
Thanks in advance.
George Collins|||On the sql server 2000 book which is downloadable freely from
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp,
there is no functionality for "MEAN" under "Transact-SQL Reference".
You might have to devise a way to calucate the MEAN yourself.
"george collins" wrote:
> Hi,
> I am trying to find if there is already a function something like "SUM" that
> can do a "MEAN". Average is too misleading for getting the "MEAN" order
> amount.
> Open for suggestions.
> Thanks in advance.
> George Collins
>
>|||Thanks I thought I had lost it there for a few minutes... I even went and
found my old Statistics book from 1975. Mean is mean. Thanks for your
response, I have been digging for a few hours and everyone thinks that
playing with an average is what I am trying to do.
Thanks you so much I will research your link.
George Collins
"dance2die" <dance2die@.discussions.microsoft.com> wrote in message
news:E71E7205-66A4-4D9E-BE3F-EDF8DA833E3E@.microsoft.com...
> On the sql server 2000 book which is downloadable freely from
> http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp,
> there is no functionality for "MEAN" under "Transact-SQL Reference".
> You might have to devise a way to calucate the MEAN yourself.
> "george collins" wrote:
>> Hi,
>> I am trying to find if there is already a function something like "SUM"
>> that
>> can do a "MEAN". Average is too misleading for getting the "MEAN" order
>> amount.
>> Open for suggestions.
>> Thanks in advance.
>> George Collins
>>|||I AM WRONG!!!!
I found it all,
thanks everyone.
George
"george collins" <george@.nospan.com> wrote in message
news:%23I%23aj1GuEHA.1048@.tk2msftngp13.phx.gbl...
> Hi,
> I am trying to find if there is already a function something like "SUM"
> that can do a "MEAN". Average is too misleading for getting the "MEAN"
> order amount.
> Open for suggestions.
> Thanks in advance.
> George Collins
>
I am trying to find if there is already a function something like "SUM" that
can do a "MEAN". Average is too misleading for getting the "MEAN" order
amount.
Open for suggestions.
Thanks in advance.
George CollinsIsn't mean just a synonym for average? Are you referring to the median?
If so, you could try this post by Celko:
http://groups.google.com/groups?hl=en&lr=&c2coff=1&selm=c0d87ec0.0210170857.72734e7c%40posting.google.com
--
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"george collins" <george@.nospan.com> wrote in message
news:%23I%23aj1GuEHA.1048@.tk2msftngp13.phx.gbl...
> Hi,
> I am trying to find if there is already a function something like "SUM"
that
> can do a "MEAN". Average is too misleading for getting the "MEAN" order
> amount.
> Open for suggestions.
> Thanks in advance.
> George Collins
>|||AVG = mean. Are you referring to median?
--
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
"george collins" <george@.nospan.com> wrote in message
news:%23I%23aj1GuEHA.1048@.tk2msftngp13.phx.gbl...
Hi,
I am trying to find if there is already a function something like "SUM" that
can do a "MEAN". Average is too misleading for getting the "MEAN" order
amount.
Open for suggestions.
Thanks in advance.
George Collins|||On the sql server 2000 book which is downloadable freely from
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp,
there is no functionality for "MEAN" under "Transact-SQL Reference".
You might have to devise a way to calucate the MEAN yourself.
"george collins" wrote:
> Hi,
> I am trying to find if there is already a function something like "SUM" that
> can do a "MEAN". Average is too misleading for getting the "MEAN" order
> amount.
> Open for suggestions.
> Thanks in advance.
> George Collins
>
>|||Thanks I thought I had lost it there for a few minutes... I even went and
found my old Statistics book from 1975. Mean is mean. Thanks for your
response, I have been digging for a few hours and everyone thinks that
playing with an average is what I am trying to do.
Thanks you so much I will research your link.
George Collins
"dance2die" <dance2die@.discussions.microsoft.com> wrote in message
news:E71E7205-66A4-4D9E-BE3F-EDF8DA833E3E@.microsoft.com...
> On the sql server 2000 book which is downloadable freely from
> http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp,
> there is no functionality for "MEAN" under "Transact-SQL Reference".
> You might have to devise a way to calucate the MEAN yourself.
> "george collins" wrote:
>> Hi,
>> I am trying to find if there is already a function something like "SUM"
>> that
>> can do a "MEAN". Average is too misleading for getting the "MEAN" order
>> amount.
>> Open for suggestions.
>> Thanks in advance.
>> George Collins
>>|||I AM WRONG!!!!
I found it all,
thanks everyone.
George
"george collins" <george@.nospan.com> wrote in message
news:%23I%23aj1GuEHA.1048@.tk2msftngp13.phx.gbl...
> Hi,
> I am trying to find if there is already a function something like "SUM"
> that can do a "MEAN". Average is too misleading for getting the "MEAN"
> order amount.
> Open for suggestions.
> Thanks in advance.
> George Collins
>
"mean" quesiton
Hi,
I am trying to find if there is already a function something like "SUM" that
can do a "MEAN". Average is too misleading for getting the "MEAN" order
amount.
Open for suggestions.
Thanks in advance.
George Collins
Isn't mean just a synonym for average? Are you referring to the median?
If so, you could try this post by Celko:
http://groups.google.com/groups?hl=e...ing.google.com
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
"george collins" <george@.nospan.com> wrote in message
news:%23I%23aj1GuEHA.1048@.tk2msftngp13.phx.gbl...
> Hi,
> I am trying to find if there is already a function something like "SUM"
that
> can do a "MEAN". Average is too misleading for getting the "MEAN" order
> amount.
> Open for suggestions.
> Thanks in advance.
> George Collins
>
|||AVG = mean. Are you referring to median?
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
"george collins" <george@.nospan.com> wrote in message
news:%23I%23aj1GuEHA.1048@.tk2msftngp13.phx.gbl...
Hi,
I am trying to find if there is already a function something like "SUM" that
can do a "MEAN". Average is too misleading for getting the "MEAN" order
amount.
Open for suggestions.
Thanks in advance.
George Collins
|||On the sql server 2000 book which is downloadable freely from
http://www.microsoft.com/sql/techinf...000/books.asp,
there is no functionality for "MEAN" under "Transact-SQL Reference".
You might have to devise a way to calucate the MEAN yourself.
"george collins" wrote:
> Hi,
> I am trying to find if there is already a function something like "SUM" that
> can do a "MEAN". Average is too misleading for getting the "MEAN" order
> amount.
> Open for suggestions.
> Thanks in advance.
> George Collins
>
>
|||Thanks I thought I had lost it there for a few minutes... I even went and
found my old Statistics book from 1975. Mean is mean. Thanks for your
response, I have been digging for a few hours and everyone thinks that
playing with an average is what I am trying to do.
Thanks you so much I will research your link.
George Collins
"dance2die" <dance2die@.discussions.microsoft.com> wrote in message
news:E71E7205-66A4-4D9E-BE3F-EDF8DA833E3E@.microsoft.com...[vbcol=seagreen]
> On the sql server 2000 book which is downloadable freely from
> http://www.microsoft.com/sql/techinf...000/books.asp,
> there is no functionality for "MEAN" under "Transact-SQL Reference".
> You might have to devise a way to calucate the MEAN yourself.
> "george collins" wrote:
I am trying to find if there is already a function something like "SUM" that
can do a "MEAN". Average is too misleading for getting the "MEAN" order
amount.
Open for suggestions.
Thanks in advance.
George Collins
Isn't mean just a synonym for average? Are you referring to the median?
If so, you could try this post by Celko:
http://groups.google.com/groups?hl=e...ing.google.com
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
"george collins" <george@.nospan.com> wrote in message
news:%23I%23aj1GuEHA.1048@.tk2msftngp13.phx.gbl...
> Hi,
> I am trying to find if there is already a function something like "SUM"
that
> can do a "MEAN". Average is too misleading for getting the "MEAN" order
> amount.
> Open for suggestions.
> Thanks in advance.
> George Collins
>
|||AVG = mean. Are you referring to median?
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
"george collins" <george@.nospan.com> wrote in message
news:%23I%23aj1GuEHA.1048@.tk2msftngp13.phx.gbl...
Hi,
I am trying to find if there is already a function something like "SUM" that
can do a "MEAN". Average is too misleading for getting the "MEAN" order
amount.
Open for suggestions.
Thanks in advance.
George Collins
|||On the sql server 2000 book which is downloadable freely from
http://www.microsoft.com/sql/techinf...000/books.asp,
there is no functionality for "MEAN" under "Transact-SQL Reference".
You might have to devise a way to calucate the MEAN yourself.
"george collins" wrote:
> Hi,
> I am trying to find if there is already a function something like "SUM" that
> can do a "MEAN". Average is too misleading for getting the "MEAN" order
> amount.
> Open for suggestions.
> Thanks in advance.
> George Collins
>
>
|||Thanks I thought I had lost it there for a few minutes... I even went and
found my old Statistics book from 1975. Mean is mean. Thanks for your
response, I have been digging for a few hours and everyone thinks that
playing with an average is what I am trying to do.
Thanks you so much I will research your link.
George Collins
"dance2die" <dance2die@.discussions.microsoft.com> wrote in message
news:E71E7205-66A4-4D9E-BE3F-EDF8DA833E3E@.microsoft.com...[vbcol=seagreen]
> On the sql server 2000 book which is downloadable freely from
> http://www.microsoft.com/sql/techinf...000/books.asp,
> there is no functionality for "MEAN" under "Transact-SQL Reference".
> You might have to devise a way to calucate the MEAN yourself.
> "george collins" wrote:
"mean" quesiton
Hi,
I am trying to find if there is already a function something like "SUM" that
can do a "MEAN". Average is too misleading for getting the "MEAN" order
amount.
Open for suggestions.
Thanks in advance.
George CollinsIsn't mean just a synonym for average? Are you referring to the median?
If so, you could try this post by Celko:
http://groups.google.com/groups?hl=...ting.google.com
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"george collins" <george@.nospan.com> wrote in message
news:%23I%23aj1GuEHA.1048@.tk2msftngp13.phx.gbl...
> Hi,
> I am trying to find if there is already a function something like "SUM"
that
> can do a "MEAN". Average is too misleading for getting the "MEAN" order
> amount.
> Open for suggestions.
> Thanks in advance.
> George Collins
>|||AVG = mean. Are you referring to median?
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
"george collins" <george@.nospan.com> wrote in message
news:%23I%23aj1GuEHA.1048@.tk2msftngp13.phx.gbl...
Hi,
I am trying to find if there is already a function something like "SUM" that
can do a "MEAN". Average is too misleading for getting the "MEAN" order
amount.
Open for suggestions.
Thanks in advance.
George Collins|||On the sql server 2000 book which is downloadable freely from
http://www.microsoft.com/sql/techin...2000/books.asp,
there is no functionality for "MEAN" under "Transact-SQL Reference".
You might have to devise a way to calucate the MEAN yourself.
"george collins" wrote:
> Hi,
> I am trying to find if there is already a function something like "SUM" th
at
> can do a "MEAN". Average is too misleading for getting the "MEAN" order
> amount.
> Open for suggestions.
> Thanks in advance.
> George Collins
>
>|||Thanks I thought I had lost it there for a few minutes... I even went and
found my old Statistics book from 1975. Mean is mean. Thanks for your
response, I have been digging for a few hours and everyone thinks that
playing with an average is what I am trying to do.
Thanks you so much I will research your link.
George Collins
"dance2die" <dance2die@.discussions.microsoft.com> wrote in message
news:E71E7205-66A4-4D9E-BE3F-EDF8DA833E3E@.microsoft.com...[vbcol=seagreen]
> On the sql server 2000 book which is downloadable freely from
> http://www.microsoft.com/sql/techin...2000/books.asp,
> there is no functionality for "MEAN" under "Transact-SQL Reference".
> You might have to devise a way to calucate the MEAN yourself.
> "george collins" wrote:
>
I am trying to find if there is already a function something like "SUM" that
can do a "MEAN". Average is too misleading for getting the "MEAN" order
amount.
Open for suggestions.
Thanks in advance.
George CollinsIsn't mean just a synonym for average? Are you referring to the median?
If so, you could try this post by Celko:
http://groups.google.com/groups?hl=...ting.google.com
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"george collins" <george@.nospan.com> wrote in message
news:%23I%23aj1GuEHA.1048@.tk2msftngp13.phx.gbl...
> Hi,
> I am trying to find if there is already a function something like "SUM"
that
> can do a "MEAN". Average is too misleading for getting the "MEAN" order
> amount.
> Open for suggestions.
> Thanks in advance.
> George Collins
>|||AVG = mean. Are you referring to median?
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com
"george collins" <george@.nospan.com> wrote in message
news:%23I%23aj1GuEHA.1048@.tk2msftngp13.phx.gbl...
Hi,
I am trying to find if there is already a function something like "SUM" that
can do a "MEAN". Average is too misleading for getting the "MEAN" order
amount.
Open for suggestions.
Thanks in advance.
George Collins|||On the sql server 2000 book which is downloadable freely from
http://www.microsoft.com/sql/techin...2000/books.asp,
there is no functionality for "MEAN" under "Transact-SQL Reference".
You might have to devise a way to calucate the MEAN yourself.
"george collins" wrote:
> Hi,
> I am trying to find if there is already a function something like "SUM" th
at
> can do a "MEAN". Average is too misleading for getting the "MEAN" order
> amount.
> Open for suggestions.
> Thanks in advance.
> George Collins
>
>|||Thanks I thought I had lost it there for a few minutes... I even went and
found my old Statistics book from 1975. Mean is mean. Thanks for your
response, I have been digging for a few hours and everyone thinks that
playing with an average is what I am trying to do.
Thanks you so much I will research your link.
George Collins
"dance2die" <dance2die@.discussions.microsoft.com> wrote in message
news:E71E7205-66A4-4D9E-BE3F-EDF8DA833E3E@.microsoft.com...[vbcol=seagreen]
> On the sql server 2000 book which is downloadable freely from
> http://www.microsoft.com/sql/techin...2000/books.asp,
> there is no functionality for "MEAN" under "Transact-SQL Reference".
> You might have to devise a way to calucate the MEAN yourself.
> "george collins" wrote:
>
Subscribe to:
Posts (Atom)
