Results 1 to 3 of 3

Thread: DELETE Having statement

  1. #1

    Thread Starter
    Lively Member PatOls's Avatar
    Join Date
    Oct 2000
    Posts
    99
    Hey ya'll

    Does anybody know how to delete this statement instead of selecting it?

    Code:
    strSql = "SELECT PartNO, Reg, WorkO FROM dOrder GROUP BY PartNO, Reg, WorkO HAVING COUNT(*) > 1"
    thx in advance for any help

    //Patrick

  2. #2
    Member
    Join Date
    Jan 2001
    Location
    Glasgow
    Posts
    47
    I think you want to delete the items that occur in your query. If so I think this will cover you.

    DELETE FROM dorder WHERE PartNO, Reg, WorkO IN
    (SELECT PartNO, Reg, WorkO FROM dOrder GROUP BY PartNO, Reg, WorkO HAVING COUNT(*) > 1)


    This will remove the whole record not just the three
    items.

  3. #3
    Hyperactive Member
    Join Date
    Nov 2000
    Location
    Mexico City
    Posts
    306
    Yes, I think its the only way: a subquery.
    If things were easy, users might be programmers.

Posting Permissions

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



Click Here to Expand Forum to Full Width