title: Getting a value from multiple tables on SQL
body: <p>I have a table, e.g. ORDERS, each order has a receipt, but the receipts are separated in 3 tables. RECEIPT1, RECEIPT2 and RECEIPT3. </p>
  
  <p>A column on table ORDERS called ORDER_TYPE will define in which of the RECEIPT tables the receipt is.</p>
  
  <p>On my query I need a logic that does something like this: If ORDER_TYPE = 'C' my query gets a value from RECEIPT1, if it's equals 'X' from RECEIPT2 and etc.</p>
  
  <p>I've already tried to use a left join on the 3 tables, but it returns triplicated rows and even if I group all of them there's still a chance of error.</p>
  
  <p>Can anyone help me? Maybe cursors (which I dont know very much how to use)?</p>