Create view  if not exists affairs_by_instance 
AS
select	a.ip_addr, a.affair_num, a.event_date,
	b.id, b.instname
from	affairs_by_ip a, instances b
where	a.instance=b.id
;
