Bill Moran said: > I've hit an SQL problem that I'm a bit mystified by. I have two different > questions regarding this problem: why? and how do I work around it? > > The following query: > > SELECT GCP.id, > GCP.Name > FROM Gov_Capital_Project GCP, > WHERE TLM.TLI_ID = $2 > group by GCP.id > ORDER BY gcp.name; > > Produces the following error: > > ERROR: column "gcp.name" must appear in the GROUP BY clause or be used in > an aggregate function
Since you're not agregating data, can't you use a select distinct instead? SELECT distinct GCP.id, GCP.Name FROM Gov_Capital_Project GCP, {?something missing here?} WHERE TLM.TLI_ID = $2 ORDER BY gcp.name; (BTW, I wasn't clear if the where clause trying to join to another table?) Doesn't answer your original question, but hope it helps anyway. John Sidney-Woollett ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly