SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2010
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to compare two table's Field and delete data not matching

    Hello everybody,

    Wanto to compare two tables the have same data, but the other one caontains more data, want compare, data not matching becomes erased? how that can be, with thanks to any help

  2. #2
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,708
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Either join the two tables and test for NULL or do a subquery for values in the second table.

    Asked and answered numerous times, check the forum for exact answers.

  3. #3
    SitePoint Enthusiast
    Join Date
    Dec 2010
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by guelphdad View Post
    Either join the two tables and test for NULL or do a subquery for values in the second table.

    Asked and answered numerous times, check the forum for exact answers.
    Or is it possible to create a new table and select the records that matches on both tables and insert it in the new table? i have an update code which uses concat, but in case of a new records to be inserted for the first time is possible such this code i have tried which is not going well need help please

    INSERT INTO newtable(Field)
    SELECT Field,Field
    FROM Table1.Field,Table2.Field
    WHERE Table1.Field=Table2.Field
    Need ideas hot adjust this code please
    with thanks

  4. #4
    SitePoint Enthusiast
    Join Date
    Dec 2010
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks guelphdad, i will check


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
  •