Question : SQL WHERE sub clause

I need to run the statement below but I am receiving the following error message:

Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

I know what the error is telling me (iti s returning more than one ponumber for the query).  I need to know how I would run that and show me all ponumber that match the where clause.

Any ideas?
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
select a.ponumber, a.itemnmbr, a.itemdesc, a.vendorid, a.unitcost, b.stndcost, b.currcost from 
(select * from pop10110) A
left join 
(select * from iv00101) B
on a.itemnmbr = b.itemnmbr
where (a.unitcost > b.stndcost) or (a.unitcost = 0) and (ponumber=(select ponumber from pop10100 where postatus = '5'))
order by ponumber asc

Answer : SQL WHERE sub clause

you have = select rather than IN select, try:
select a.ponumber, a.itemnmbr, a.itemdesc, a.vendorid, a.unitcost, b.stndcost, b.currcost from
(select * from pop10110) A
left join
(select * from iv00101) B
on a.itemnmbr = b.itemnmbr
where (a.unitcost > b.stndcost) or (a.unitcost = 0) and (ponumber IN (select ponumber from pop10100 where postatus = '5'))
order by ponumber asc
Random Solutions  
 
programming4us programming4us