home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / database / 9350 < prev    next >
Encoding:
Internet Message Format  |  1993-01-23  |  1.5 KB

  1. Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!not-for-mail
  2. From: muench-philip@math.yale.edu (Philip Muench)
  3. Newsgroups: comp.databases
  4. Subject: Re: Help with SQL statement
  5. Date: 23 Jan 1993 10:48:45 -0500
  6. Organization: Yale University Mathematics Dept., New Haven, CT 06520-2155
  7. Lines: 29
  8. Distribution: na
  9. Message-ID: <1jrpctINNbqk@CANTOR.MATH.YALE.EDU>
  10. References: <1993Jan22.211051.4867@vpnet.chi.il.us>
  11. NNTP-Posting-Host: cantor.math.yale.edu
  12.  
  13. In article <1993Jan22.211051.4867@vpnet.chi.il.us> mike@vpnet.chi.il.us writes:
  14. >I'm having a problem writing an SQL statement for the following situation
  15. >(and I'm not sure its really possible)
  16. >
  17. >I have 2 tables lets say I have a Customer table and an order table.
  18. >I want to query the database for all customers and show their orders
  19. >for the past month.  I may have more than 1 order for a customer.
  20. >
  21. >The problem is that if I don't have an order for a customer, the join will
  22. >not find a match and that customer will be left out of the report.
  23. >
  24. >I still want to show the customer even if no orders are present.
  25. >
  26. >Is this possible with SQL ??  was my explanation clear enough ??
  27. >
  28. >Thanks 
  29. >
  30. >   Mike Kamlet
  31. >   mike@vpnet.chi.il.us
  32. >
  33. >
  34.  
  35. Put a false order that you can easily recognize as false in the order
  36. table for every customer, or at least for every customer that has no
  37. real order.
  38. Joins, as you have found, are useless for finding records in one table
  39. that do not have a corresponding record in the other table.
  40. -Philip Muench
  41.  muench@cantor.math.yale.edu 128.36.23.26
  42.