Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.
SELECT lawson_temp.employee_nbr, 3 AS SurveyType_DataSort, 'Annual Survey' AS SurveyType, (CASE WHEN AnnualSurvey_DateCompleted.DateCompleted IS NOT NULL THEN LEFT(CONVERT(VARCHAR(10), adj_hire_date, 101), 5) + '/' + CONVERT(VARCHAR(4), YEAR(AnnualSurvey_DateCompleted.DateCompleted)) ELSE CONVERT(VARCHAR(10), DATEADD(yy, +1, adj_hire_date), 101) END) AS EligibilityDate, AnnualSurvey_EmailDate.EmailDate AS EmailDate, AnnualSurvey_DateCompleted.DateCompleted FROM lawson_temp LEFT OUTER JOIN (SELECT employee_nbr, CONVERT(VARCHAR(10), email_date, 101) AS EmailDate FROM survey_email WHERE survey_id = 20) AS AnnualSurvey_EmailDate ON lawson_temp.employee_nbr = AnnualSurvey_EmailDate.employee_nbr LEFT OUTER JOIN (SELECT TOP (100) PERCENT user_survey_id, employee_nbr, DateCompleted FROM vwSurveys_SPSS WHERE survey_id = 20 ORDER BY DateCompleted) AS AnnualSurvey_DateCompleted ON lawson_temp.employee_nbr = AnnualSurvey_DateCompleted.employee_nbr
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.