Subquery help - one works, two doesnt - Informix

When I run this query with only one subquery, the statement works. But when I put the two subqueries in the same sql statement, the sql editor just keeps running, with no data being returned. Any help is appreciated!!!

select distinct r.studentid, r.studentname, r.building || '*' || trim(r.grade) || '*' || trim(r.currcode) combo
from reg r, seats s
where
r.status = 'A' and
r.building = s.bldg and
trim(r.currcode) <> ''
and

(r.building || '*' || trim(r.grade) || '*' || trim(r.currcode) ) not in (
select distinct s.bldg || '*' || trim(s.grade) || '*' || trim(s.prog) combo from seats s)
or
(r.building || '*' || trim(r.grade) || '*' || trim(r.currcode) ) in (
select distinct s.bldg || '*' || trim(s.grade) || '*' || trim(s.prog) combo from seats s
where s.seats = 0)
[959 byte] By [zombie_man23] at [2007-11-19 11:09:13]
# 1 Re: Subquery help - one works, two doesnt - Informix
Queries having "in" are slow, and so are queries having "or".

But I suppose that the problem is elsewhere.
Perhaps the database engine is confused by your alias "s".

You use it in three different circunstances.
I would rather use s1, s2, and s3.

select distinct r.studentid, r.studentname, r.building || '*' || trim(r.grade) || '*' || trim(r.currcode) combo
from reg r, seats s1
where
r.status = 'A' and
r.building = s1.bldg and
trim(r.currcode) <> ''
and

(r.building || '*' || trim(r.grade) || '*' || trim(r.currcode) ) not in (
select distinct s2.bldg || '*' || trim(s2.grade) || '*' || trim(s2.prog) combo from seats s2)
or
(r.building || '*' || trim(r.grade) || '*' || trim(r.currcode) ) in (
select distinct s.bldg || '*' || trim(s3.grade) || '*' || trim(s3.prog) combo from seats s3
where s3.seats = 0)
olivthill at 2007-11-9 13:41:54 >
# 2 Re: Subquery help - one works, two doesnt - Informix
I needed an extra set of parenthesis to surround the or subqueries.

Thanks for the help though!!!

and
((r.building || '*' || trim(r.grade) || '*' || trim(r.currcode) ) not in (
select distinct s.bldg || '*' || trim(s.grade) || '*' || trim(s.prog) combo from seats s)
or
(r.building || '*' || trim(r.grade) || '*' || trim(r.currcode) ) in (
select distinct s.bldg || '*' || trim(s.grade) || '*' || trim(s.prog) combo from seats s
where s.seats = 0))
zombie_man23 at 2007-11-9 13:42:56 >