There's a part of query i don't understand it
Can some explain it please?
(@a:=concat(@a,schema_name,'<br>')
If we consider that schema_name
return all the databases name
Is it loop or what i can't understand
There's a part of query i don't understand it
Can some explain it please?
(@a:=concat(@a,schema_name,'<br>')
If we consider that schema_name
return all the databases name
Is it loop or what i can't understand
Presumably, that is a statement in a select
:
select @a := concat(@a, schema_name, '<br>')
from t;
If @a
is initialized to NULL
, then this returns NULL
. Typically, it would be initialized to an empty string (''
).
If so, it constructs a string containing all the values of schema_name
followed by <br>
. So, if the table contained:
schema_name
a
b
c
The result would be 'a<br>b<br>c<br>'
in the @a
variable (and MySQL will return this result as well).
In MySQL, you would normally use group_concat()
for this purpose.