[comp.databases] Bug in INGRES??

serafim@nada.kth.se (Serafim Dahl) (01/20/89)

where Emp=employee, sal=salary, mgr=manager, dept=department

the following query:
a)
	select avg(sal) from Emp where dept in
		(select dept from Emp where name = 'Smith')
gives the answer '8383.333'.

Examining the query, breaking it down as follows:
b)
	Select dept from Emp where name='Smith';
(giving the answer 'food')
	select avg(sal) from Emp where dept='food';
gives the answer '7795.833'.

It turns out that, in query a all duplicates in sal are eliminated,
while in b they quite correctly are not eliminated.

					/serafim@nada.kth.se