Delete data from 1 table using 2nd table in Redshift when all the columns are not populated

3783 views sql
-1

I have 2 tables in redshift which have same schema (name, age, roll). My table contains entry for only name column in both the tables and I am executing delete query :

DELETE FROM table1 USING table2 WHERE table1.name = table2.name

this query is not deleting the data. But if I populate all the fields in my table and then run query with all the matching columns it works.

How to go about this scenario ?

any leads would be appreciated.

answered question

1 Answer

3

This should help

delete from table1 where name in 
(select table1.name from table1, table2
    where table1.name = table2.name)

posted this

Have an answer?

JD

Please login first before posting an answer.