0
嗨,我有問題想切換FirstWordLength的輸出到該輸出打印每個第一個字的字符量顯示的數據集
SELECT InvoiceLineItemDescription,
LEFT(InvoiceLineItemDescription,
CASE
WHEN charindex(' ', InvoiceLineItemDescription) = 0 THEN LEN(InvoiceLineItemDescription)
ELSE charindex(' ', InvoiceLineItemDescription) - 1 END)
AS FirstWordLength
FROM InvoiceLineItems
ORDER BY FirstWordLength desc;
應該看的第一個字的長度是這樣的:
InvoiceLineItemDescription FirstWordLength
citi bank 4
用您正在使用的數據庫標記您的問題。 –