MySQL query result that use value of other fields
I'm looking for something like format()
in开发者_C百科 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)
how about:
SELECT CONCAT('some text ', field1, ', ', field2, ' some text.') FROM table;
create a column in query and give it any alias to get result in. see this example.
SELECT ('some text, ' + tb.Col1 + ', ' + tb.Col2) AS ColName
FROM
MyTable tb
精彩评论