Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2004
    Location
    Montreal, Canada
    Posts
    151

    Question Unanswered: validating 2 table's plz help

    I have one table called product 1 and the second table is called product 2 i have DirNo, ProdNo, UpdCode and BranchOffice as fields i whant to loop trought every record in table product 1 and check in table product 2 if the record is the same and exist i f it does go to next record, if not delete the record in product 1 and move to the next record and so on. could someone please help me. iam very new at this.
    thanks
    Last edited by hillcat; 07-30-04 at 17:31.

  2. #2
    Join Date
    Jan 2004
    Location
    Montreal, Canada
    Posts
    151
    can someone please help with this.

    thanks

  3. #3
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    DELETE p1
    FROM product1 p1
    LEFT OUTER JOIN product2 p2 ON p1.DirNo = p2.DirNo
    AND p1.ProdNo = p2.ProdNo
    AND p1.UpdCode = p2.UpdCode
    AND p1.BranchOffice = p2.BranchOffice
    WHERE
    p2.DirNo IS NULL
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

  4. #4
    Join Date
    Jan 2004
    Location
    Montreal, Canada
    Posts
    151
    it doesent seem to like the Alias before the left outer join and when removing it it doesnt like the left.

  5. #5
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    This is a classic T-SQL syntax. What DBMS are you working with?
    "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
  •