I have been formatting a select query into one giant string with set lengths:
SELECT DISTINCT
CONCAT(CONCAT(ulname,SPACE(15-LENGTH(ulname))))
FROM users WHERE ulname = 'Test'
But is it possible to do the same with a blank alias? If I were to do
Select '' AS CustomerID
I'm not exactly sure how I would set the spacing then. Would it be something like
CONCAT('' AS CustomerID, SPACE(10 - LENGTH(CustomerID)))?
答案 0 :(得分:0)
Maybe you are looking for something like this:
SELECT DISTINCT
LEFT(CONCAT(ulname,SPACE(15)),15)
FROM test
WHERE ulname = 'test';