I have a SQL query that works perfectly that I need to convert to Linq. I need to return all the records one table and join it to a second table. I need to return all of the results from the first table joined with results from the second table where the value of a specific field in the second table equals a variable value (75 in the example below) or returns null.
So the total number of rows in the result should be the total number of rows from table1. The part of the row from the join from table2 should either show values from table2 where a record existed with a value of 75 or null where the record doesn't exist.
EDIT: I should mention that t1.field1 is an int and t2.field1 is a nullable int.
I tried multiple linq statements, grouping joins, asking coworkers, and googling til my eyes bleed. I'm stuck. I realize my question wording may not be clear, and I apologize in advance if it isn't.
Thanks in advance. Chris
The SQL Query:
SELECT *
FROM table1 AS t1 LEFT OUTER JOIN
table2 AS t2 ON t1.field1 = t2.field1 AND t2.field2 = 75