I think that you must use '<=' or '>=' in both of queries.
0 additional answers
Sort by: Most helpful
Why difference between Inner Join and select in columns?
The following queries are used to find out the common rows between TableX and (TableY and TableZ).
Why the difference and where am I missing?
SELECT count(*) from TableX
INNER JOIN TableY on TableX.ColX=TableY.ColX
INNER JOIN TableZ on TableY.ColID= TableZ.ColID
where TableZ.[DtCreated] <= '2015-08-02 23:59:59.998' and TableZ.EntityID = 31068
---The above query gives 107 Rows
select count(*) from TableX where ColX in (select ColX from TableY INNER JOIN TableZ on TableY.ColID= TableZ.ColID where TableZ.[DtCreated] >= '2015-08-02 23:59:59.998' and Tablez.EntityID = 31068)
---The above query gives 900,000 rows
Sign in to comment