fabrizio
fabrizio

Reputation: 259

Fake column mysql with value

Hello guys i would like know if possible add a fake column with a value that it doesn't exist on the database. Example:

table user

id_user | name | surname |

1         jhon    Smith
2         Elis    Sun

When i'll go to select i would like put a fake column called type_user with the value 1

result

id_user | name | surname | type_user /* fake column */
1         jhon   Smith       1
1         Elis   Sun         1

Upvotes: 1

Views: 3404

Answers (2)

Taryn
Taryn

Reputation: 247810

You will just hard-code the column and value:

select id_user, name, surname, 1 as type_user
from user

Upvotes: 6

Moob
Moob

Reputation: 16204

SELECT id_user, name, surname, 1 as type_user FROM ...

Upvotes: 1

Related Questions