You have this table:

id data
3 2
2 1
1 3

This query:
SELECT @var, data, @var:=data+(IFNULL(@var,0)) FROM table

What would result would you expect the first time you execute the query?
I would expect this:
NULL, 2, 2
2, 1, 3
3, 3, 6

But this is what you get the first time:
NULL, 2, 2
NULL, 1, 1
NULL, 3, 3
and next execution:
3, 2, 5
5, 1, 6
6, 3, 9

Can you explain this?

Greetings from Denmark
/Stig


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to