Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    4

    Arrow Unanswered: Problem with Delete query.

    What I have is two tables. One with all the customer details(eg. account number, name, address, etc.. called QFL and another with Notes for them call QFL NOTES with stuff like notes in them. These two tables have a relationship joined by the ac number field.

    Now I want to issue a statement to delete all records from QFL NOTES from the account
    which has has ODUE3_BAL and ODUE3_BAL that is greater than 0 in the QFL table, their QFL NOTES date has to be 7 days old and LETTER2 is yes.

    This is what I tried but it don’t seem to work.

    DELETE [QFL NOTES].*

    FROM [QFL NOTES] RIGHT JOIN QFL ON [QFL NOTES].AC_NUMBER=QFL.NUMBER

    WHERE ((([QFL NOTES].DATE)<DateAdd("d",-7,Date())) AND (([QFL NOTES].LETTER2)=Yes) AND ((QFL.ODUE3_BAL)<="0") AND ((QFL.ODUE4_BAL)<="0"));

    Can anyone help as I am fairly new to SQL.

  2. #2
    Join Date
    Mar 2004
    Location
    Adelaide, Australia
    Posts
    32
    Try:

    DELETE *.[QFL NOTES] FROM ........

    Generally it works like this; [columnname].[tablename], so *.[QFL NOTES] would reference all columns in the QFL NOTES table.


    HTH.
    Regards,
    Rod.

    Programmer response #5 - "Even though it doesn't work, how does it feel?"

Posting Permissions

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