Reputation: 1771
I'm looking for something like format()
in other programming languages in MySQL query. The expected result is text that has values from other fields.
For example, something like
select formatted from table where formatted=stringformat('some text {0}, {1} some text.', field1, field2)
Upvotes: 2
Views: 74
Reputation: 21
SELECT ('some text, ' + tb.Col1 + ', ' + tb.Col2) AS ColName
FROM
MyTable tb
Upvotes: 0
Reputation: 6842
how about:
SELECT CONCAT('some text ', field1, ', ', field2, ' some text.') FROM table;
Upvotes: 3