1

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

Dharman
  • 30,962
  • 25
  • 85
  • 135
dragon
  • 81
  • 1
  • 8

1 Answers1

0

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.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786