home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / database / ingres / 960 < prev    next >
Encoding:
Text File  |  1992-07-20  |  2.0 KB  |  58 lines

  1. Newsgroups: comp.databases.ingres
  2. Path: sparky!uunet!darwin.sura.net!uvaarpa!cv3.cv.nrao.edu!mail-to-news-gateway
  3. From: Stephan Ozminski <OZMINSKI%MSUKBS.BITNET@pucc.Princeton.EDU>
  4. Subject: Q: nested group by
  5. Message-ID: <01GMLK295O0GA3CNUC@MSUKBS.BITNET>
  6. Sender: daemon@nrao.edu
  7. Organization: National Radio Astronomy Observatory
  8. Date: Mon, 20 Jul 1992 14:33:00 GMT
  9. Lines: 47
  10.  
  11. Does anyone know about the following bug?  I ask on the net because we
  12. do not have Technical Support, only Update Support, so I am not likely
  13. get a response if I sent them a message directly.  So, I'm posting to
  14. the net without first asking Ingres.
  15.  
  16. It is possible for Ingres (SunOS v6.3 and v6.4/01) to return incorrect
  17. results if a view with a group by clause references a view with a
  18. group by clause, even though relational theory would dictate
  19. otherwise.
  20.  
  21. Nested group by clauses are necessary because Ingres SQL does not
  22. support nested aggregate functions.  Of course the alternative is to
  23. create intermediate tables, but I should have to do that.  I don't
  24. like having to remember to delete junk tables.
  25.  
  26. Here is an example of nested group by clauses:
  27.  
  28. create view tagcountv as
  29. select id, subentry, tag, count(tag) as tagcount
  30. from datatable
  31. GROUP BY ID, SUBENTRY, TAG;
  32.  
  33. create view tag_max as
  34. select tag, max(tagcount) as maxcount
  35. from tagcountv
  36. GROUP BY TAG;
  37.  
  38. When I select from tag_max, I get repeats of several of the tags, with
  39. different maximum counts.
  40.  
  41. If I change tagcountv to have a group by clause of:
  42.  
  43.         GROUP BY TAG, ID, SUBENTRY
  44.  
  45. Then the aggregates are calculated properly.  Presumably, the problem
  46. is caused by Ingres not sorting the table resulting from tagcountv,
  47. before it calculates aggregates for tag_max.  Is this a general
  48. problem with SQL implementations or just an Ingres bug?
  49.  
  50. -Stephan
  51.  
  52. Stephan J. Ozminski            Bitnet:    OZMINSKI@MSUKBS
  53. Michigan State University      Internet:  OZMINSKI%KBS.DECNET@CLVAX1.CL.MSU.EDU
  54. W.K. Kellogg Biological Station
  55. 3700 E. Gull Lake Dr.
  56. Hickory Corners, MI 49060
  57.  
  58.