How can I delete records base on the value of a fieled in the 1st recor?

  • I generate a small table with a SELECT INTO from a larger table. One of the fields in the new table is 'Org'. I have to treat Org = ABC as a special case. So IF the Org in the first row is ABC, DELETE all other rows.

    If the Org in the first row is NOT ABC, keep all rows.

    How would I construct this query?

  • Sounds like homework, which is fine, I am happy to help, but please post the some table definitions (CREATE TABLE statements) and some sample data (INSERT statements) as well as your expected results (per the sample data).

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • opc.three (12/31/2012)


    Sounds like homework, which is fine, I am happy to help, but please post the some table definitions (CREATE TABLE statements) and some sample data (INSERT statements) as well as your expected results (per the sample data).

    Plus what you have written so far in an effort to solve your problem.

    It helps to know what you have done so that we can guide to the correct solution.

Viewing 3 posts - 1 through 2 (of 2 total)

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