home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.oracle      Overblown overpriced overengineered SHIT      2,288 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 2,277 of 2,288   
   Jakub Otrzasek to All   
   Re: Multiple Inner and Left Joins   
   19 Apr 10 16:15:21   
   
   From: n30@nospam.n30.info   
      
   Alastair Williamson pisze:   
   > Hello,   
   >   
   > I am trying to find the correct sql query syntax to join multiple tables   
   > together including at least two left joins. I have 1 master table which   
   > inner joins to 4 tables and then left joins to 2. The inner joins are   
   > obviously no problem but I can only get one of the left joins working.   
   >   
   > Does anyone have a working example of a query with such a join in it?   
   >   
   > Many thanks   
   >   
   > Aly   
   >   
   >   
   select  t.naz,t.kod_p,t.rp,   
   case when j.war is null then 1 else war end war,   
   case when j.wym_x is null then t.wym_x else j.wym_x end wym_x,   
   case when j.wym_y is null then t.wym_y else j.wym_y end wym_y,   
   case when j.wym_z is null then t.wym_z else j.wym_z end wym_z,   
      
   case when j.wag_n is null then t.wag_n else j.wag_n end wag_n,   
   case when j.wag_b is null then t.wag_b else j.wag_b end wag_b,   
   t.kod_3,t.kod_2   
   from interface.imperr   
   inner join tow@PROD t on   
   err_what = 1002 and err_errid=0   
   and t.kod_2 = err_whatid and   
   err_system = t.kod_3   
   left outer join tow_jm@PROD j on   
   j.tow_kod = t.kod and   
   j.cjm = 'Opakowanie' and   
   --t.wsk_d='T' and akt='T' and   
   t.kod_3 in (1,2)   
   left outer join interface.imptwr_iface i on   
   twr_numer =t.kod_2 and   
   twr_System = t.kod_3   
   where twr_numer is null;   
      
   regards   
   j.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca