SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast MeLoDi's Avatar
    Join Date
    Sep 2003
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Delete query not quite correct

    hi there i need to delete some values which have dates that are less than today's from a table. The date is in another table so i joined the two tables together and gave a clause

    I did this:
    Code:
    DELETE *
    FROM RMASerial, Sold
    WHERE RMASerial.SoldID=Sold.SoldID 
    And Sold.Warranty_date<Date();
    But that doesnt seem to be working. Could anyone enlighten me? haha thanks

  2. #2
    HardCoder md_irfan_amu's Avatar
    Join Date
    May 2005
    Location
    Asia
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    DELETE *
    FROM RMASerial, Sold
    WHERE RMASerial.SoldID=Sold.SoldID
    And Sold.Warranty_date<Date();

    Just remove the * and u find the solution....

    Regards
    Irfan
    Find Tutors Easyway to get connect with your tutor in india

  3. #3
    SitePoint Enthusiast MeLoDi's Avatar
    Join Date
    Sep 2003
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi i removed the *

    But it still gave me an error:
    Specify the table containing the records you want to delete.

  4. #4
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does it throw an Error?

    Ignore that! I've always had problems with dates and access. Try using the DATEDIFF function and delete anything that has a return value more than zero.


  5. #5
    HardCoder md_irfan_amu's Avatar
    Join Date
    May 2005
    Location
    Asia
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can u tell me the error which is coming..
    Irfan
    Find Tutors Easyway to get connect with your tutor in india

  6. #6
    SitePoint Enthusiast MeLoDi's Avatar
    Join Date
    Sep 2003
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nvm managed to solve it already
    Code:
    DELETE FROM RMASerial
      WHERE RMASerial.SoldID IN(SELECT Sold.SoldID FROM Sold WHERE Sold.Warranty_date<Date());


Bookmarks

Posting Permissions

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