well, it seems to be fine without SUM and GROUP BY...
E.g.,
SELECT @a:=Charge, @b:=Cost, @[EMAIL PROTECTED] as Margin ...
produces expected results.
Emmett Bishop wrote:
Vadim,
if I'm not mistaken, you can't set a variable then use
it in the same statement.
See
P. [EMAIL PROTECTED]
To: Emmett Bishop [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: Re: User variables + SUM + GROUP BY = strange behavior
Date: Fri, 16 Apr 2004 05:50:12 -0400
well, it seems to be fine without SUM and GROUP BY...
E.g.,
SELECT @a:=Charge, @b:=Cost, @[EMAIL PROTECTED
Hello all,
Could anyone comment on User Variable behavior in the example below?
Thanks,
Vadim.
=
mysql SELECT
- LEFT(CallTime,10) AS CallDate,
- @a := SUM(Charge),
- @b := SUM(Cost),
-
Sorry, the message got garbled, here is a more digestible look:
-Original Message-
Hello all,
Could anyone comment on User Variable behavior in the example below?
Thanks,
Vadim.
=
mysql SELECT
-
Vadim,
if I'm not mistaken, you can't set a variable then use
it in the same statement.
See http://dev.mysql.com/doc/mysql/en/Variables.html
A little ways down the page...
The general rule is to never assign and use the same
variable in the same statement.
-- Tripp
--- Vadim P. [EMAIL