Hi,
I have 3 tables table1 a, table2 b and table3 c as follows
a.ssn
a.name1
a.name2
a.addr1
a.addr2
a.addr3
a.city
a.state
a.zip
b.somenumber
c.somecode
I have to pull the data from above 3 tables. I have to match the records based on the column 'ssn' which is present in all tables.
The 2nd condition will be for table c where c.somecode='0'
CREATE TABLE NEW_TABLE AS(SELECT a.ssn, a.name1, a.name2,a.addr1, a.addr2, a.addr3,
a.city, a.state, a.zip, b.somenumber from table1 a, table2 b, table3 c where
(a.ssn=b.ssn) and c.somecode=0
);
The problem is, each of these table have 80-90 million rows each. And my queries are taking a long time to run.
Can somebody please help me with a more efficient query.
Thanks,
N
I have 3 tables table1 a, table2 b and table3 c as follows
a.ssn
a.name1
a.name2
a.addr1
a.addr2
a.addr3
a.city
a.state
a.zip
b.somenumber
c.somecode
I have to pull the data from above 3 tables. I have to match the records based on the column 'ssn' which is present in all tables.
The 2nd condition will be for table c where c.somecode='0'
CREATE TABLE NEW_TABLE AS(SELECT a.ssn, a.name1, a.name2,a.addr1, a.addr2, a.addr3,
a.city, a.state, a.zip, b.somenumber from table1 a, table2 b, table3 c where
(a.ssn=b.ssn) and c.somecode=0
);
The problem is, each of these table have 80-90 million rows each. And my queries are taking a long time to run.
Can somebody please help me with a more efficient query.
Thanks,
N