This is the SQL statement:
mysql -u user -p password -e "SELECT concat(name,'-',number) from users
where email='test@test.com'"
Expected output: john-1234
Actual output: concat(name,'-',number)
john-1234
Why is this happening?
This is the SQL statement:
mysql -u user -p password -e "SELECT concat(name,'-',number) from users
where email='test@test.com'"
Expected output: john-1234
Actual output: concat(name,'-',number)
john-1234
Why is this happening?
MySQL will return column names. You can give it a more useful alias like this:
SELECT concat(name,'-',number) as username from users
where email='test@test.com'
EDIT: Looks like @jarlh beat me to it in the comments.
just give an alias of your column name other wise it will concat(name,'-',number) as column name
"SELECT concat(name,'-',number) as output from users
where email='test@test.com'"
It is name of the column.
You can name it in other way:
SELECT concat(name,'-',number) AS nameAndNumber from users where email='test@test.com'