Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!pyramid!voder!blia!blipyramid!mike From: mike@blipyramid.BLI.COM (Mike Ubell) Newsgroups: comp.databases Subject: Re: Informix 4GL Question? Message-ID: <62@blipyramid.BLI.COM> Date: 25 Feb 88 14:45:08 GMT References: <714@uel.uel.co.uk> <2314@geac.UUCP> <974@pasteur.Berkeley.Edu> Organization: Britton Lee, Inc. Lines: 19 Keywords: Informix 4GL Summary: aggregate is not correct In article <974@pasteur.Berkeley.Edu>, larry@postgres.uucp (Larry Rowe) writes: > the referenced messages asked about relational calculus queries that > answer the queries: > 1. get the first occurrence of some predicate > 2. get the first N occurrences of some predicate > 3. return true/false if an occurrence exists > QUEL has an aggregate function that does numbers 1 and 3. the ANY > this illustrates query 3. query 1 is simple to do, just put the ANY > aggregate in the predicate rather than the target list. for example, > > RETRIEVE (emp.all) > WHERE ANY(emp.name by emp.dept where emp.dept= "toy") = 1 > > the by-clause is needed to link the tuple variable in the ANY > aggregate to the record constructed in the target list. The above aggregate returns all emp records where emp.dept = "toy". Quel joins the by list to ALL records in the original relation not just the first one.