delete with cast option

  • delete from table1

    where cast(t1_field as char(10)) not in (select cast(t2_field as char(10)) from table2)

  • Hello,

    The basic Jet SQL syntax for multi table delete with joins is:

    DELETE

    Table1 FROM Table1 WHERE EXISTS (SELECT t2 FROM table2 WHERE table1.t1 = Table2.t2) ;

    You can add the type conversions in by using the CStr function - Cast isn't supported in Jet SQL.

    DELETE

    Table1 FROM Table1 WHERE EXISTS (SELECT t2 FROM table2 WHERE CStr (table1.t1) = CStr (Table2.t2));

    John

  • i didn't understand the whole thing. will somebody please help me in this thing?

    .........

  • thanks...

  • It seems to me that Roy's sql statement deletes all the records in t1 which aren't present in t2 while John's deletes all records in t1 which are also present in t2.

  • This can be fixed by changing WHERE EXISTS to WHERE NOT EXISTS

  • i got this taken care of guys thanks for all the info.

    i don't have the exact syntax available right now but in my application it is all working fine.

    So....

    Thank you all very much.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply