
15 Jan
2009
15 Jan
'09
3:02 p.m.
On Thu, Jan 15, 2009 at 9:13 AM, dariuszs
Hi, table1 - 1,000,000 records table2 - 300,000 records (from table1) table3 - 400,000 records (from table1)
They key (key27) on all tables is varchar(27) SQL
select count(*) from table1 where key27 in (select key27 from table2, table3); (the answer should be 700,000)
At this point server crashed.
I'm trying to join 3 tables to get a count on table1 only when there is a match in table2 or table3. Could you provide me with a sample how to properly match 3 or more tables based on the match key? Thank you. Dariusz.
Just curious, does it work if you don't have a cartesian product in the subquery? (there is no condition to match table2 rows with table3 rows)