I am trying to convert the following SQL to LINQ:
SELECT 'Employer' note_type, TRUNC (dated) dated, note
FROM PHSP.employer_note
WHERE employer = :employer AND popup = 'Y'
UNION
SELECT 'Employee', TRUNC (dated), note
FROM PHSP.employee_note
WHERE employee = :employee AND popup = 'Y'
It checks if there is notes for the employer_note table then concatenates notes from the employee_note table.
This is what I did:
(from e in EmployerNotes
where e.Employer == 37471 &&
e.Popup == "Y"
select new { Dated = e.Dated, Note = e.Note, note_type= "Employer"})
.Concat(
from n in EmployeeNotes
where n.Employee == 34715 &&
n.Popup == "Y"
select new { Dated = n.Dated, Note = n.Note, note_type= "Employee"})
For the specific employee there is notes in both and the notes are shown from both, but the Type always says "Employer" even though it should be "Employer for first row and "Employee" for second row.
Is there something else needed so the types will show correctly depending on what table they were selected from?
Thank you.