title: Expression cannot be a statement - Salesforce
body: <p>The following code works fine. The Id variable that I see in my debug log when I execute the code is the correct 18 digit Id. </p>
  
  <pre><code>    List&lt;Opportunity&gt; psgPrimaryProjectIDToDelete = [Select pse__Primary_Project__c from Opportunity];
      System.debug('***************PSG Primary Project Name is ' + psgPrimaryProjectIDToDelete[0]);
      Id myId = psgPrimaryProjectIDToDelete[0].id;
          System.debug('***********myId = ' + myId);
  </code></pre>
  
  <p>The problem occurs when I try to use that Id variable to return a result in my select statement that follows it. I keep getting the error: Expression cannot be a statement.</p>
  
  <p>I get that error when I follow my working code with this:</p>
  
  <pre><code>[Select Id from PSG_Vendor_Order__c where PSG_Project__c = :myId];
  </code></pre>
  
  <p>Or with this:</p>
  
  <pre><code>Set&lt;Id&gt; s = new Set&lt;Id&gt;();
  s.add(myId);
  [Select Id from PSG_Vendor_Order__c where PSG_Project__c in :s;  
  </code></pre>
  
  <p>The error shows up on the select statement but I have no idea why.... Can anyone help?</p>