lundi 21 septembre 2015

SQL Subquery issue 3

I have a issue with my SQL code.

When I run this code I'm getting such error mesage:

**

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

**

I don't know how to correct this code to run it?

Can somebothy look at it and help me with it?

Thank you for your help,

SELECT dbo.FRA$.[GUID], dbo.FRA$.[Last Name], 

dbo.FRA$.[First Name], dbo.FRA$.[HR Manager Last Name], 

dbo.FRA$.[HR Manager First Name], (SELECT dbo.FRA$.[Business Email Address] FROM dbo.FRA$ t WHERE t.[HR Manager ID] = t.[Emplid]) AS [HR Manager E-Mail],

dbo.LOC.Descr AS [COMPANY NAME], dbo.FRA$.[Location Code],

dbo.LOC.[ADDRESS], dbo.LOC.Postal, dbo.LOC.City, dbo.FRA$.[National ID], dbo.FRA$.[Current Employee Class Desc] AS [Current Empl Class],

dbo.FRA$.[Contract type description] AS [CONTRACT TYPE], dbo.FRA$.[Business Title],

CASE dbo.FRA$.[Current Employee Class Desc]
WHEN 'Operator' THEN 10
WHEN 'Clerical worker' THEN 22
WHEN 'Technician' THEN 32
WHEN 'Supervisor' THEN 33
WHEN 'Manager&Engineer' THEN 54
END AS [Salary brutto],

FORMAT(dbo.FRA$.[Birthdate],'yyyy-MM-dd') AS [Birth Date], FORMAT(dbo.FRA$.[Last Start Date],'yyyy-MM-dd') AS [Hire Date]

FROM dbo.FRA$  

INNER JOIN dbo.LOC 

ON dbo.FRA$.[Location Code] = dbo.LOC.[Location]

WHERE [HR Status] IN ('International Assignment','Active','Leave of Absence');

Aucun commentaire:

Enregistrer un commentaire