X
x-rays
Hello all,
I have a simple select statement:
SELECT Count(*)
FROM Table1 a where exists (Select 1 from Table2 b where a.Country =
b.Country and a.Factory = b.Factory and a.Code = b.Code and a.Type =
b.Type);
the problem I'm facing is that this query takes too much time to run.
Table1 has 44500 rows and Table2 685000 rows.
Any ideas how to reconstruct the statement to get results?
I tried these too with no luck:
SELECT Count(*)
FROM Table1 a where Code in (Select b.Code from Table2 b where
a.Country = b.Country and a.Factory = b.Factory and a.Code = b.Code and
a.Type = b.Type);
SELECT Count(*)
FROM Table1 a
INNER JOIN Table2 b
On a.Country = b.Country and a.Factory = b.Factory and a.Code = b.Code
and a.Type = b.Type);
Thanks in advance!
I have a simple select statement:
SELECT Count(*)
FROM Table1 a where exists (Select 1 from Table2 b where a.Country =
b.Country and a.Factory = b.Factory and a.Code = b.Code and a.Type =
b.Type);
the problem I'm facing is that this query takes too much time to run.
Table1 has 44500 rows and Table2 685000 rows.
Any ideas how to reconstruct the statement to get results?
I tried these too with no luck:
SELECT Count(*)
FROM Table1 a where Code in (Select b.Code from Table2 b where
a.Country = b.Country and a.Factory = b.Factory and a.Code = b.Code and
a.Type = b.Type);
SELECT Count(*)
FROM Table1 a
INNER JOIN Table2 b
On a.Country = b.Country and a.Factory = b.Factory and a.Code = b.Code
and a.Type = b.Type);
Thanks in advance!