Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ukma!xanth!lll-winken!uunet!bsadrc!carver From: carver@bsadrc.UUCP (Darrel R. Carver) Newsgroups: comp.databases Subject: Informix sql sum/group by question Message-ID: <131@bsadrc.UUCP> Date: 21 Mar 89 02:54:45 GMT Reply-To: carver@bsadrc.UUCP (Darrel R. Carver) Distribution: na Organization: CommTek Publishing Company Lines: 27 I have a order entry application written in Informix SQL. The cash transaction system has a table that looks somewhat like this create table tr_dat ( tr_num serial(1000), tr_vendor integer, { link to vendor table } tr_date date, { Date of transaction } tr_amt money(5,2) { Amount of transaction } ); I wish to sum up and display all the transactions for a particular vendor with the following statement select sum(amt), amt from tr_dat where tr_vendor = 5; Informix gives me an error saying the amt must be in a group by statement, i.e. select sum(amt), amt from tr_dat where tr_vendor = 5 group by amt; My question is why? Why should I have to have the amt in a group by clause? -- Darrel R Carver - A clever quote goes here. Have we got any in CommTek Publishing Company - the unquotable quotes? Vienna, Va 22180 - uunet!bsadrc!carver - Mr. Bear