iam getting the Incorrect Near the Keyword 'AS', Can anyone help me.
The following is the code.
SELECT CASE WHEN [tblcontract].[ShipCont]=2 OR [tblcontract].[ShipCont]=3 THEN CASE WHEN [tblcontract].[DtShip02] IS NOT NULL AND [tblcontract].[DtShip03] IS NOT NULL AND [tblcontract].[DtShip04] IS NOT NULL THEN [tblContract].[DtShip04] WHEN [tblcontract].[DtShip02] IS NOT NULL AND [tblcontract].[DtShip03] IS NOT NULL THEN [tblContract].[DtShip03]
WHEN [tblcontract].[DtShip02] IS NOT NULL THEN [tblContract].[DtShip02] WHEN [tblcontract].[DtShip01] IS NOT NULL THEN [tblContract].[DtShip01] ELSE NULL END AS LSDDate, ContNo, QtyShip01 AS Qty, Buyer
FROM dbo.tblcontract
The following is the code.
SELECT CASE WHEN [tblcontract].[ShipCont]=2 OR [tblcontract].[ShipCont]=3 THEN CASE WHEN [tblcontract].[DtShip02] IS NOT NULL AND [tblcontract].[DtShip03] IS NOT NULL AND [tblcontract].[DtShip04] IS NOT NULL THEN [tblContract].[DtShip04] WHEN [tblcontract].[DtShip02] IS NOT NULL AND [tblcontract].[DtShip03] IS NOT NULL THEN [tblContract].[DtShip03]
WHEN [tblcontract].[DtShip02] IS NOT NULL THEN [tblContract].[DtShip02] WHEN [tblcontract].[DtShip01] IS NOT NULL THEN [tblContract].[DtShip01] ELSE NULL END AS LSDDate, ContNo, QtyShip01 AS Qty, Buyer
FROM dbo.tblcontract