Article ID: 154353
Article Last Modified on 3/14/2005
create table X (xCol1 int not null,
xCol2 int not null)
go
create table Y (yCol1 int not null)
go
create view vX
as
select xCol1, xCol2
from X
where xCol1 =
(select yCol1
from Y
where yCol1 = xCol1)
go
select max(xCol2), xCol1 from vX group by xCol1
create view vX
as
select xCol1, xCol2
from X
where xCol1 in -- using 'in' instead of '='
(select yCol1
from Y
where yCol1 = xCol1)
-or-
create view vX -- rewriting, using a join instead
as
select xCol1, xCol2
from X,Y
where xCol1 = yCol1
Additional query words: AV SUM AVG COUNT MAX MIN
Keywords: kbbug kbfix kbnetwork KB154353