如何顯示來自[Tbl_Employee所有員工FIRST_NAME和LAST_NAME對於 如:如何顯示這些查詢
First_name Last_Name Display
Abhi Kulshrestha A K
如何顯示來自[Tbl_Employee所有員工FIRST_NAME和LAST_NAME對於 如:如何顯示這些查詢
First_name Last_Name Display
Abhi Kulshrestha A K
您可以使用「爲」用於創建列的標題像的下方,可以連接字符串列值如下。
SELECT top 1 'First_name : '+Firstname AS 'First_name',
'Last_Name: '+Lastname AS 'Last_name',
'Display: '+ left(isnull(Firstname,'.'),1) + ' ' + left(isnull(Lastname,'.'),1) AS 'Display'
FROM [Tbl_Employee]
select left(isnull(First_name,'.'),1) + ' ' + left(isnull(Last_name,'.'),1) from Tbl_Employee
您標記兩個SQL服務器和sqllite,這是什麼呢?
的SQL Server:
select
FirstName
, LastName
, isnull(left(FirstName,1)+' ','') + isnull(left(LastName,1),'') as Display
from [Tbl_Employee]
sqllite:
select
FirstName
, LastName
, substr(Lastname1,1,) || ' ' ||substr(FirstName,1,1) as Display
from [Tbl_Employee]
顯示哪裏...? – iamdave
您使用的是MS SQL Server還是Sqlite? – jarlh