Wildan Muhlis
Wildan Muhlis

Reputation: 1603

Treat Text value as A Field

In MySql, could we use text as a field?

SELECT (SELECT 'it_is_my_field_name_come_from_a_text') FROM my_table

Upvotes: 0

Views: 65

Answers (1)

JanT
JanT

Reputation: 2096

SELECT 'it_is_my_field_come_from_a_text' FROM my_table ...

will work fine, maybe you could add the following alias to it:

AS `My Field From Text`

So, the final query looks like this:

SELECT 'it_is_my_field_come_from_a_text' AS `My Field From Text` FROM my_table ...

Upvotes: 1

Related Questions