home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / database / informix / 1769 < prev    next >
Encoding:
Internet Message Format  |  1992-08-21  |  3.1 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!europa.asd.contel.com!emory!saad-emh1.ARMY.MIL
  2. From: maint72@saad-emh1.ARMY.MIL (Michael Gordon)
  3. Newsgroups: comp.databases.informix
  4. Subject: Lookup and Query.
  5. Message-ID: <9376@emory.mathcs.emory.edu>
  6. Date: 21 Aug 92 23:18:03 GMT
  7. Sender: walt@mathcs.emory.edu
  8. Reply-To: maint72@saad-emh1.ARMY.MIL (Michael Gordon)
  9. Lines: 67
  10. X-Informix-List-ID: <list.1392>
  11.  
  12.  
  13.  
  14. REPLY TO: CHARLEEN STONER
  15.  
  16. REFERENCE: LOOKUP ROWS AND QUERY.
  17.  
  18.  
  19. < I'm running INFORMIX-SQL Version 2.10.03F.
  20. < I have a screen form that uses a table, info.  There's a state column
  21. < in info.  One of my users wants to see territories (which will depend 
  22. < on state) on this form.  He wants the territory information to reside
  23. < in another table, salestate, which has a state column, and three
  24. < territory columns.
  25. < No problem, right?  You just do a lookup join:
  26. < [attribute] = info.state = salestate.state,
  27. <    lookup [ter1] = salestate.territory1 joining *salestate.state,
  28. <    lookup [ter2] = salestate.territory2 joining *salestate.state,
  29. <    lookup [ter3] = salestate.territory3 joining *salestate.state;
  30. < ...and it looks fine:
  31. < Territory     WE  WE  WE
  32. < [...portion of form deleted]
  33. < City         [San Francisco            ]  State [CA]      Zip [94110     ]
  34. < No problem, except that this user wants to be able to query on the
  35. < territory fields (to get all the records of the appropriate states), 
  36. < which we all know you can't do with a lookup field.
  37. < Is there a way to do something *like* a lookup without actually using
  38. < a lookup join?  
  39. < Sorry if this is a dumb question or if I'm missing something obvious...
  40. < Charleen
  41.  
  42.  
  43. Charleen,
  44.  
  45. ( The ONLY REALLY dumb question, is the question NOT asked because it was
  46. thought to be a DUMB QUESTION.)
  47.  
  48. It sounds to me like you need to use a MASTER OF and DETAIL relationship
  49. between the two tables you have used for the lookup commnad.
  50.  
  51. The master/detail relationship simplifies cross-table queries, especially when
  52. one row of the master table is associated with several rows of the detail
  53. table.
  54.  
  55. (Above statement drawn from the Informix Reference Manual for SQL v. 2.1.0)
  56.  
  57. In this manner the user can query the master table for the state in question,
  58. obtain the necessary basic information, execute the MASTER/DETAIL command to
  59. shift over to the detail table and query the territories fields.
  60.  
  61. Good luck.
  62.  
  63.  
  64.  
  65.                     Michael S. Gordon
  66.                     Foreman, Gyroscope Section
  67.                     Avionics Division 
  68.  
  69.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  70.  *                                                                           *
  71.  *  Michael Gordon                           Sacramento Army Depot           *
  72.  *  Foreman, Gyroscope Section               Directorate For Maintenance     *
  73.  *  E-Mail: maint72@saad-emh1.army.mil       Attn: SDSSA-MAV-320             *
  74.  *  DSN:    839-2367                         Michael S. Gordon               *
  75.  *  Comm.:  (916) 388-2367                   Sacramento, CA 96813-5036       *
  76.  *                                                                           *
  77.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  78.  
  79.