title: Is it possible to select a column from a database and not display it in the result set - if selected, causes an issue with Group By
body: <p>I have a query that's being use in my application. I had to make a small edit to it (select an additional column) and now that I do that, I don't get the same results, therefore I get a bad file. Just to give example this is what the query looks like ....</p>
  
  <pre><code>Select 
      'X' = tblA.VendorNumber, 
      'Y' = tblB.Label, 
      'Z' = tblC.InvoiceNo, 
      'W' = tblD.Checks, 
  From //Doing some joins here
  Group By 
      tblA.VendorNumber, tblB.label, tblc.InvoiceNo, tblD.Checks
  </code></pre>
  
  <p>The result set gives me many records, but groups by the ones with identical X,Y,Z,W - so with no Group By it would look like this</p>
  
  <pre><code>X                Y                 Z                  W
  -----------------------------------------------------------
  123              Anton             772                0
  123              Anton             772                0
  </code></pre>
  
  <p>Obviously, with the group by they are rolled up into one...</p>
  
  <p>The issue comes when I try to include an additional column in my <code>Select</code> query. I need this query in my, because I need to value in my code to be able to distinguish what type of record it is. With the new column, these two rows of data are not the same, therefore they do not get rolled up. </p>
  
  <p>Is there a way for me to somehow add an additional column, but not display it, and exclude it from the <code>Group By</code>?</p>
  
  <p>This is what I mean</p>
  
  <pre><code>Select 
      'X' = tblA.VendorNumber, 
      'Y' = tblB.Label, 
      'Z' = tblC.InvoiceNo, 
      'W' = tblD.Checks, 
      'P' = tblC.Proc     -- New column
  From //Doing some joins here
  Group By 
      tblA.VendorNumber, tblB.label, tblc.InvoiceNo, tblD.Checks,
      tblC.Proc       -- New column
  </code></pre>
  
  <p>In this case the data looks like this</p>
  
  <pre><code>X                Y                 Z                  W          P
  ---------------------------------------------------------------------
  123              Anton             772                0          FPN
  123              Anton             772                0          PPN
  </code></pre>
  
  <p>So now that P is different for the 2 records that previously were rolled up into one, is there a way for me to somehow not display P, however, still be able to get it's value from my record set. I am unable to select the 'P' if it's not selected in this one query and because of the fact that the two records are not rolling up, I'm having some major issues.</p>
  
  <p>Basically I need to select 'P' but not include it in my result set or group by.</p>
  
  <p>Any help would be much appreciated.</p>