Here is the code I've been trying to reduce to a single SQL select.  It works 
fine as is but I'm trying to understand if there is a way to do it in a single 
statement. Perhaps this is already the simplest approach?
 
TIA - Joe Yoder
 
  CREATE CURSOR Family (Id I)
  CREATE CURSOR Members (Parent I, Type C(1), Jcode C(1))
  CREATE CURSOR Jobs (Code C(1), Jdesc C(1))
  INSERT INTO Family (Id) VALUES (1)
  INSERT INTO Family (Id) VALUES (2)
  INSERT INTO Members (Parent, Type, Jcode) VALUES (1, 'a', '1')
  INSERT INTO Members (Parent, Type, Jcode) VALUES (1, 'b', '2')
  INSERT INTO Members (Parent, Type, Jcode) VALUES (2, 'a', '3')
  INSERT INTO Jobs (Code, Jdesc) VALUES ('1', 'A')
  INSERT INTO Jobs (Code, Jdesc) VALUES ('2', 'B')
  INSERT INTO Jobs (Code, Jdesc) VALUES ('3', 'C')
 
  SELECT * FROM Members LEFT JOIN Jobs ON Jcode == Code INTO CURSOR MC
 
  SELECT Family.Id, M1.Type as Typ1, M2.Type as Typ2, M1.Jdesc as Job1, 
M2.Jdesc as Job2;
  FROM Family LEFT JOIN MC as M1 ON Id == M1.Parent AND M1.type = 'a';
              LEFT JOIN MC as M2 ON Id == M2.Parent AND M2.type = 'b'


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to