home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / database / theory / 712 < prev    next >
Encoding:
Text File  |  1993-01-24  |  1.5 KB  |  58 lines

  1. Newsgroups: comp.databases.theory
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!spool.mu.edu!yale.edu!ira.uka.de!Germany.EU.net!incom!arlac!markus
  3. From: markus@arlac.rhein-main.de (Markus Felten)
  4. Subject: cummulation in view columns
  5. Message-ID: <1993Jan24.133327.2772@arlac.rhein-main.de>
  6. Sender: markus@arlac.rhein-main.de
  7. Organization: MF
  8. Date: Sun, 24 Jan 1993 13:33:27 GMT
  9. Lines: 47
  10.  
  11.  
  12. Dear SQL Users
  13.  
  14. Well this should have been simple, but
  15. supposed I have a table like this
  16.  
  17. create table material_amount(
  18.     material    char(1),
  19.     date        datetime,
  20.     amount        float)
  21.  
  22. with sample data:
  23.  
  24. material    date    amount
  25. -------------------------------
  26.  A     Jan 5 1993      20
  27.  B     Jan 1 1993     200
  28.  A     Jan 1 1993     100
  29.  A     Jan 3 1993      50
  30.  B     Jan 6 1993      10
  31.  
  32. How can I build a VIEW material_total with [ total = sum(amount)
  33. from now to date ],
  34. the order of rows does not matter?
  35.  
  36. material_total then should look like this:
  37.  
  38. material    date    total
  39. -------------------------------
  40.  A     Jan 1 1993     100
  41.  A     Jan 3 1993     150        ( 100 + 50 )
  42.  A     Jan 5 1993     170        ( 100 + 50 + 20 )
  43.  B     Jan 1 1993     200
  44.  B     Jan 6 1993     210        ( 200 + 10 )
  45.  
  46. Any help would be mostly welcomed.
  47.  
  48. Markus
  49.  
  50. --------------------------------------------------------------------------
  51. Markus Felten                         Phone: +049 6171 59387
  52. Systemanalyse u. Systementwicklung  
  53. Lange Str.59                        Email:  
  54. markus@arlac.rhein-main.de 
  55. 6370 Oberursel (near Frankfurt a.M.)
  56. Germany
  57. --------------------------------------------------------------------------
  58.