问题
Table Values
CNAME
Firstname
Amount
Postalcode
Lastname
Accountnumber
REQUIRED O/P
CNAME
'Firstname'
'Amount'
'Postalcode'
'Lastname'
'Accountnumber'
回答1:
In mysql you can use the function concat():
SELECT CONCAT("'", CNAME, "'") FROM yourTable
In oracle you can use the same function as above concat() or the concatenation operator:
SELECT '''' || CNAME || '''' FROM yourTable;
SELECT CONCAT('''', CNAME, '''') FROM yourTable;
来源:https://stackoverflow.com/questions/41736930/output-with-single-quote-in-sql