title: "Only one expression can be specified in the select list when the subquery is not introduced with EXISTS."
body: <p>I have a fairly complex Linq query:</p>
  
  <pre><code>var q = from eiods in LinqUtils.GetTable&lt;EIOfficialDesignee&gt;()
          let eiodent = eiods.Entity
          join tel in LinqUtils.GetTable&lt;EntityTelephone&gt;()
          on new { EntityID = eiodent.ID, TelephoneType = EntityTelephone.TTelephone.Office } equals new { tel.EntityID, tel.TelephoneType }
          into Tel
          let Tel1 = Tel.FirstOrDefault()
          join fax in LinqUtils.GetTable&lt;EntityTelephone&gt;()
          on new { EntityID = eiodent.ID, TelephoneType = EntityTelephone.TTelephone.Fax } equals new { fax.EntityID, fax.TelephoneType }
          into Fax
          let Fax1 = Fax.FirstOrDefault()
          join cell in LinqUtils.GetTable&lt;EntityTelephone&gt;().DefaultIfEmpty()
          on new { EntityID = eiodent.ID, TelephoneType = EntityTelephone.TTelephone.Mobile } equals new { cell.EntityID, cell.TelephoneType }
          into Mobile
          let Mobile1 = Mobile.FirstOrDefault()
          where eiods.ID == CurrentEIPatient.EIOfficialDesigneeID
          select new {
            ID = eiods.ID,
            EIODName = eiodent.FormattedName,
            Phone = Tel1 != null ? Tel1.FormattedNumber : "",
            Fax = Fax1 != null ? Fax1.FormattedNumber : "",
            Cellphone = Mobile1 != null ? Mobile1.FormattedNumber : "",
          };
  </code></pre>
  
  <p>This query is returning me an SQL error:</p>
  
  <pre><code>Only one expression can be specified in the select list when the subquery is not introduced with EXISTS
  Only one expression can be specified in the select list when the subquery is not introduced with EXISTS
  Only one expression can be specified in the select list when the subquery is not introduced with EXISTS
  </code></pre>
  
  <p>Yes, in triplicate.  That's an obvious indicator that the problem with the query is being repeated 3 times i.e. in the 3 different types of phone number.</p>
  
  <p>According to the SQL server documentation, this comes from a malformed query.  But this is Linq, for heaven's sake!  How can it be malforming the query?</p>
  
  <p>Aside from the main answer, I'd also appreciate any comments you may have about optimizing my query...</p>
  
  <p>Thanks!</p>