title: Select One row each from one to many relationship
body: <p>I have a following structure for my account management software</p>
  <pre><code>Transaction
  ==================
  Id | Description | CreditAccountId (FK_AccountId) | DebitAccountId (FK_AccountId)
  1  | Tran1       | 1                              | 2  
  
  Account
  ==================
  Id | Title    | Description 
  1  | DebitAc  | Debit Account
  2  | CreditAc | Credit Account
  
  Posting
  ==================
  Id | Amount  | Currency | TransactionId (FK_Transaction) | TransactionType (Debit/Credit)
  1  | 10.00   | EUR      | 1                              | Debit
  2  | 10.00   | EUR      | 1                              | Credit
  </code></pre>
  <p>Each transaction has 2 postings, one each for debit and credit.</p>
  <p>On applying the following query, I am getting each transaction twice.</p>
  <pre><code>select t.id from [transaction] t 
      JOIN Account da ON t.DebitAccountId = da.Id
      JOIN Account ca ON t.CreditAccountId = ca.Id
      JOIN posting p on p.TransactionId = t.Id 
  order by t.id
  </code></pre>
  <p>like so</p>
  <pre><code>TransactionId | Description
  1             | Tran1
  1             | Tran1
  </code></pre>
  <p>this is because the transaction table is joined to posting and two postings are returned, thereby duplicating the transactions.</p>
  <p>How can I modify this query so that only one row is returned per transaction ?</p>