Re: [SQL] Subquery error. Help please!!

2001-06-28 Thread Wei Weng
What version of postgresql are you using? On 27 Jun 2001 17:09:14 -0400, kakerjak wrote: Hey all.. Here's the table definition. CREATE TABLE laboratory ( id int4 NOT NULL, subid int2 NOT NULL, name varchar(30) NOT NULL, CONSTRAINT laboratory_pkey PRIMARY KEY (id, subid))

Re: [SQL] Subquery error. Help please!!

2001-06-28 Thread Tom Lane
kakerjak [EMAIL PROTECTED] writes: If the subquery is placed before the JOIN, like it is above, then the error i get says 'parse error at or near select' If i flip the subquery around with the laboratory table then i get 'parse error at or near (' Are you using 7.1?

Re: [SQL] Subquery error. Help please!!

2001-06-28 Thread Ross J. Reedstrom
I did something similar, but pu the subselect into a view, in the WHERE clause. SELECT * FROM modules m WHERE (m.module_ident = (SELECT max(modules.module_ident) AS max FROM modules WHERE (m.moduleid = modules.moduleid) GROUP BY modules.moduleid)); The equivalent for you would be something