Results 1 to 3 of 3

Thread: delete query ?

  1. #1
    Join Date
    Mar 2004
    Posts
    205

    Unanswered: delete query ?

    Hi,

    Is this a valid SQL Server query :

    DELETE FROM D FROM D WHERE LEFT JOIN H ON H.key=D.key WHERE H.key IS NULL

    Please advise.

    Thanks,
    Sam

  2. #2
    Join Date
    Jul 2004
    Posts
    13

    No

    It is not valid SQL. Joins are only allowed in the FROM clause.

    If you'd bothered to mention what you are trying to do it might have been possible to give some legal SQL that does it.

    Dag

  3. #3
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Your syntax is almost correct except for one too many FROMs and WHEREs:

    DELETE D FROM D LEFT JOIN H ON D.key=H.key WHERE H.key IS NULL
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

Posting Permissions

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