Copy Records from two tables to new Table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ak1dnar
    Recognized Expert Top Contributor
    • Jan 2007
    • 1584

    Copy Records from two tables to new Table

    I have two table in my end.
    Clinics
    Hospitals

    Now I need to get some records from this Query and Insert them to a new table

    [CODE=sql]SELECT
    Clinics.clinic_ no,
    Clinics.Hosptl_ no,
    Hospitals.Hospt l_no,
    Hospitals.hospt l_name
    FROM Clinics
    INNER JOIN Hospitals ON Clinics.Hosptl_ no = Hospitals.Hospt l_no
    [/CODE]
  • hariharanmca
    Top Contributor
    • Dec 2006
    • 1977

    #2
    Originally posted by ajaxrand
    I have two table in my end.
    Clinics
    Hospitals

    Now I need to get some records from this Query and Insert them to a new table

    [CODE=sql]SELECT
    Clinics.clinic_ no,
    Clinics.Hosptl_ no,
    Hospitals.Hospt l_no,
    Hospitals.hospt l_name
    FROM Clinics
    INNER JOIN Hospitals ON Clinics.Hosptl_ no = Hospitals.Hospt l_no
    [/CODE]
    you can try this

    Code:
    insert into NewTableName (Field1, Field2, Field3, Field4) SELECT 
    Clinics.clinic_no,
    Clinics.Hosptl_no,
    Hospitals.Hosptl_no,
    Hospitals.hosptl_name
    FROM Clinics
    INNER JOIN Hospitals ON Clinics.Hosptl_no = Hospitals.Hosptl_no

    Comment

    • ak1dnar
      Recognized Expert Top Contributor
      • Jan 2007
      • 1584

      #3
      Thanks a bunch hariharanmca.

      Comment

      • hariharanmca
        Top Contributor
        • Dec 2006
        • 1977

        #4
        Originally posted by ajaxrand
        Thanks a bunch hariharanmca.

        You are most welcome moderator

        Comment

        • ak1dnar
          Recognized Expert Top Contributor
          • Jan 2007
          • 1584

          #5
          Originally posted by hariharanmca
          You are most welcome moderator
          Mod for PHP-Forum not to here :)

          Comment

          • hariharanmca
            Top Contributor
            • Dec 2006
            • 1977

            #6
            Originally posted by ajaxrand
            Mod for PHP-Forum not to here :)
            okay, No problem...cool

            Comment

            Working...