Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2008

    Question Unanswered: Need help with simple Query, multi column index...


    I am pulling my hair out over what should be a simple query, but for some reason I can't get it to work.

    I have two tables both with multi-column indexes and I need to delete rows in table 2 based on info in table 1.

    Example: Table1 (*'s denote unique key)


    Example Table 2


    I need to delete the records in table 2 based on the T1_chg value.

    Please help. I must be missing something as I feel I've done this before...

  2. #2
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    Please post the SQL that you've got so far. That will help us formulate a correct answer for you a lot faster than the pseudo-data that you've posted.

    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Aug 2008
    Thanks for the reply. Nevermind though.

    Two minutes after posting it hit me.

    delete from table2 where exists(select * from table1 where T1_cat = T2_cat (etc, etc..)... AND T1_chg = 'YADA YADA')

    Thanks for the quick response.

  4. #4
    Join Date
    Jun 2005
    just a little nit and not sure if affects performance but I always do:

    (SELECT 1 FROM...)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts