now try:Code:select sum(111) = 111
any you get some looks like randome numbers.Code:select sum(111) from xtable
select sum(111) from ytable
Any explanation ?
Printable View
now try:Code:select sum(111) = 111
any you get some looks like randome numbers.Code:select sum(111) from xtable
select sum(111) from ytable
Any explanation ?
what is xtable ?
it is any table.
its the number of entrys 3 times eg if you have 51 rows it will output 515151
or not, 4 rows = 444
31 rows = 3441
so its 111 * rows
Correct. 55 rows would be 5661.
It's easy to see this, Bubikol, if you doWhat you are telling SQL (any SQL, not just MySQL) to do is to add 111 to the sum for each row in the table.Code:SELECT COUNT(*), SUM(111) FROM xtable
Think about it: If you do
all that tells SQL to do is to add the value of field someField to the sum for each row in the table. So when you use a constant, instead, it is the constant that gets added for each row.Code:SELECT SUM(someField) FROM xtable
Nothing "random" about it.