I'm afraid I can't spot my error anymore... Any hints?
select pc.c,count(pc.c)
from rawrequest,pers_comp as pc
where pc.p=pid
group by pc.c
having count(pc.c)=1
;
c | count
-----+-------
16 | 1
38 | 1
59 | 1
63 | 1
83 | 1
89 | 1
128 | 1
138 | 1
146 | 1
154 | 1
156 | 1
158 | 1
203 | 1
204 | 1
221 | 1
257 | 1
314 | 1
333 | 1
(18 rows)
update rawrequest
set cid=(select pc.c
from pers_comp as pc
where pc.p=pid
group by pc.c
having count(pc.c)=1
)
where pr
;
ERROR: More than one tuple returned by a subselect used as an expression.
pid, pc.p, pc.c, cid are all integers. pc just has 2 columns p and c.
I thought putting the count()=1 in there would force a single tuple..
Cheers,
Patrick