Re: Resettin Running Total
From: Roji. P. Thomas (lazydragon_at_nowhere.com)
Date: 08/16/04
- Next message: Aaron [SQL Server MVP]: "Re: Udf inside Where clause possible?"
- Previous message: Steve Kass: "Re: select data from Excel"
- In reply to: G.C.Mandrake: "Re: Resettin Running Total"
- Next in thread: G.C.Mandrake: "Re: Resettin Running Total"
- Reply: G.C.Mandrake: "Re: Resettin Running Total"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 17 Aug 2004 00:20:32 +0530
(woth Courtesy to Louis)
SELECT col1, col2, sum(col3) as Total
GROUP BY col1, col2
is considered okay, so why u always recommend a tool instead of
Select col1, col2, concatenate(col2, varcharcolumn) as UDAggregate
GROUP BY col1, col2
-- Roji. P. Thomas Net Asset Management https://www.netassetmanagement.com "G.C.Mandrake" <steve.nospam.@rac4sql.net> wrote in message news:eoAg$47gEHA.536@TK2MSFTNGP11.phx.gbl... > With Yukon on the horizon it's important that users,especially > those just coming to the sql world, have as clear an understanding > of concepts as possible.For example, > > "Joe Celko" <jcelko212@earthlink.net> wrote in message > news:O903SghgEHA.3988@tk2msftngp13.phx.gbl... > > . > > 3) Running totals are a report. We do reports in the front end with > > report writers and format data in the front end. You do not do this in > > the database. This the whole idea of tiered architectures. > > Yet in the thread: > From: Joe Celko > Subject: Re: Alternative for TOP > Newsgroups: microsoft.public.sqlserver.programming > Date: 2004-08-04 11:09:22 PST > http://tinyurl.com/4q7hz > > You write: > 'The best answer given uses a subquery to establish a subset based on a > count.' > > SELECT DISTINCT salary > FROM Personnel AS P1 > WHERE @n >= (SELECT COUNT(*) - 1 -- control parameter > FROM Personnel AS P2 > WHERE P1.salary < P2.salary) > > Now the same correlated subquery idea can, of course, when used > with *SUM*, give a running total.You are simply telling users that > the *same* construct is appropriate or non appropriate based > on its intent, ie. display(Select) vs. filter(Where). > Is this the message you really want to give? > >
- Next message: Aaron [SQL Server MVP]: "Re: Udf inside Where clause possible?"
- Previous message: Steve Kass: "Re: select data from Excel"
- In reply to: G.C.Mandrake: "Re: Resettin Running Total"
- Next in thread: G.C.Mandrake: "Re: Resettin Running Total"
- Reply: G.C.Mandrake: "Re: Resettin Running Total"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|