Bug with assignment operator ( := )
| From: | Ross Honniball | Date: | Sun, 29 Aug 2004 01:10:22 +0000 |
| Subject: | Bug with assignment operator ( := ) | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-35923@lists.php.net to get a copy of this message | ||
SQL Statement:
select *,@xtotal := StkhistMonthqty06 + StkhistMonthqty07 + StkhistMonthqty08 as total
from StkMast as sm inner join StkHist as sh using (STkCode)
where (StkAuthor like 'keller%')
and (sh.StkhistYear='2004')
and (@xtotal>0);
Notice the use of @xtotal.
I have saved some output from an instance where I ran this query and it worked as expected.
Subsequently it has stopped finding any results. (the table has definitly NOT changed).
If I take out the and (@xtotal>0) clause, it finds records (and, whatsmore, I can see that xtotal is indeed greater than zero.
Does anyone know of any erratic behaviour when using the assignment operator?
Or am I doing something wrong?
(Note that this is actually the first time I have ever used the assignment operator, so I'm pretty green really)
.
. Ross Honniball. JCU Bookshop Cairns, Qld, Australia.
.