home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / database / 6567 < prev    next >
Encoding:
Internet Message Format  |  1992-09-07  |  1.4 KB

  1. Path: sparky!uunet!ogicse!uwm.edu!ux1.cso.uiuc.edu!news.cs.indiana.edu!nstn.ns.ca!ac.dal.ca!pchua
  2. From: pchua@ac.dal.ca
  3. Newsgroups: comp.databases
  4. Subject: FoxPro 2.0 SQL - outer join
  5. Message-ID: <1992Sep4.164144.7346@ac.dal.ca>
  6. Date: 4 Sep 92 13:41:44 GMT
  7. Article-I.D.: ac.1992Sep4.164144.7346
  8. Organization: Dalhousie University, Halifax, Nova Scotia, Canada
  9. Lines: 39
  10.  
  11. I am trying to use FoxPro 2.0 SQL to perform a Master/Detail join (or
  12. left outer natural join) for my application reports but having
  13. difficulty to do so. Let say I have a Master table STUDENT with
  14. fields id, lastname, firstname and a Detail table COURSE with fields id,
  15. courseid. The following is my SQL command:
  16.  
  17. SELECT    student.id,            ;
  18.     student.lastname,        ;
  19.     student.firstname,        ;
  20.     course.courseid         ;
  21. FROM    student,            ;
  22.     course                 ; 
  23. WHERE    student.id = course.id        ;
  24.  
  25. UNION                     ;
  26.  
  27. SELECT    student.id,            ;
  28.     student.lastname,        ;
  29.     student.firstname,        ;
  30.     '' AS courseid             ;
  31. FROM    student                ;
  32. WHERE    NOT EXISTS             ;
  33.     (                ;
  34.     SELECT    *            ;
  35.     FROM    course            ;
  36.     WHERE    student.id = course.id    ;
  37.     )
  38.  
  39. The problem is at "'' AS courseid". I am not sure what is the syntax in
  40. FoxPro to assign an empty string for courseid. Any suggestion?
  41.  
  42. My other concern is the performance of the outer join. Besides
  43. introducing redundency control by maintaining a detail existence flag
  44. for each master row , are there any other approaches? Suggestions would
  45. be appreciated.
  46.  
  47.  
  48. Poh Chua (e-mail: PCHUA@AC.DAL.CA)
  49. Dalhousie University
  50.