尝试将dosrorder.nummer添加到Dossier.nummer但不幸的是SQL告诉我
数据类型nvarchar和nvarchar在'&'中不兼容。操作
SELECT
Dossier.OrderType, Dossier.Nummer AS OrderNummer,
DosrOrder.Nummer, Dossier.Nummer & [.] & DosrOrder.Nummer AS Totaal
FROM
Dossier
INNER JOIN
DosrOrder ON Dossier.ID = DosrOrder.DosrID
答案 0 :(得分:3)
您使用错误的方法在SQL Server中进行连接。正确的方法是使用+
(假设您的列为NVARCHAR
):
SELECT D.OrderType,
D.Nummer AS OrderNummer,
DO.Nummer,
D.Nummer + N'.' + DO.Nummer AS Totaal
FROM Dossier AS D
INNER JOIN DosrOrder AS DO
ON D.ID = DO.DosrID