I'm already aware of USER()
. How do I just get the username - i.e the stuff before 开发者_C百科@
+------------------+
| USER() |
+------------------+
| billy@localhost |
+------------------+
I want simple billy
. This will be used in a TRIGGER.
Thanks
SELECT SUBSTRING_INDEX(USER(),'@',1);
See: Information Functions: USER()
from help:
SELECT SUBSTRING_INDEX(USER(),'@',1);
精彩评论