title: Inserting columns with subquery/join
body: <p>I am having troubles to insert correct data into my tables. I have tables as below:</p>
  
  <p>Here are tables with data:  </p>
  
  <p>•   Theatre(Theatre#, Name)<br>
  •   Trow(TR#, RowName, RowType, Theatre#)<br>
  •   Tseat(TS#, SeatNo, TR#)<br>
  •   Season(Season#, SeasonName, Year)<br>
  •   Production(P#, Season#, Title)<br>
  •   ProductionRun(P#, Theatre#)<br>
  •   Performance(Per#, P#, Theatre#,Weekday)<br>
  •   Client(Client#,name )<br>
  •   TicketPurchase(Purchase#, Client#, Per#,TotalAmount, TS#) </p>
  
  <p>My tables are for example as below:</p>
  
  <p>•   ProductionMy(P#,Title)  </p>
  
  <p>Into this table I would like to insert columns <strong>P#</strong> and <strong>Title</strong> from table <strong>Production</strong> and to insert only rows where column Per# from table Performance matches column Per# in table TicketPurchase</p>
  
  <p>Another table for example is :</p>
  
  <p>•   TimeID(TimeID,Month,Year,Weekday,SeasonName)  </p>
  
  <p>I would need to insert unique instances of time from table Performance and <strong>SeasonName</strong> from <strong>Season</strong> table based on criteria if <strong>Per#</strong> in <strong>Performance</strong> table and <strong>Per#</strong> in <strong>TicketPurchase</strong> table matches. I tried for example below with no success:</p>
  
  <p>insert  into  time  select time_seq.nextval,month,year,weekday,SeasonNAme from 
  (select distinct<br>
  extract(month from pDate) month, 
  extract(year from pDate) year,
  Weekday,
  SeasonName 
  from Performance, Season);</p>
  
  <p>Or another example .I have table:</p>
  
  <p><strong>TRowMY</strong>(TR#,RowType)</p>
  
  <p>I would like to insert here data from <strong>RowType,TR#</strong> columns in <strong>RowType</strong> table based on the criteria that TS# column in <strong>TicketPurchase</strong> table matches <strong>TS#</strong> column in <strong>TSeat</strong> table.</p>
  
  <p>Or another example, my table:</p>
  
  <p>ClientMy(Client#,Name)</p>
  
  <p>I want to insert columns <strong>Client#,Name</strong> from column <strong>Client</strong> only when <strong>Client#</strong> in <strong>Client</strong> table matches <strong>CLient#</strong> in <strong>TicketPurchase</strong> table.</p>
  
  <p>Basically I need to insert data that has been involved in ticket sales as not all performance, seasons, or productions/clients that are in tables are in the <strong>TicketPurchase</strong> table.</p>
  
  <p>I really stuck in here, please could you at least help me with some tables, so that I will have idea who to deal with rest, please.</p>
  
  <p>Hope i have explained this well...</p>
  
  <p>Regards,</p>