title: Distinct or group by in Epicor 9 BAQ editor
body: <p>I need to join the TranGLC table to the APInvDtl table in Epicor 905 in a Business Activity Query.</p>
  
  <p>I am currently joining on <code>Company, VendorNum, InvoiceNum, InvoiceLine, JobNum</code> and can't see any other columns that would be suitable for the join.</p>
  
  <p>My problem is that join does not uniquely identify the records in the APInvDtl table, so if my query returns 14 rows from TranGLC, when I join the two tables, I get 196 records.</p>
  
  <p>In sql I can use the Distinct key word, and I get the results I'm looking for, but I can't see a way to do that in the BAQ editor.</p>
  
  <p>I can also get the results I"m looking for by using a SQL group by, but again, I don't know how to do that in the BAQ editor.</p>
  
  <p>I've researched ABL, and it looks like you can do a first-of in ABL code that might behave in the same way group by does, but I can't see how to do that in the BAQ editor either.</p>
  
  <p>Any suggestions on how to remove the duplicates from the result set would be greatly appreciated.</p>