469,133 Members | 982 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,133 developers. It's quick & easy.

Copy Records from two tables to new Table

ak1dnar
1,584 Expert 1GB
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

Expand|Select|Wrap|Line Numbers
  1. SELECT 
  2. Clinics.clinic_no,
  3. Clinics.Hosptl_no,
  4. Hospitals.Hosptl_no,
  5. Hospitals.hosptl_name
  6. FROM Clinics
  7. INNER JOIN Hospitals ON Clinics.Hosptl_no = Hospitals.Hosptl_no
  8.  
Jul 17 '07 #1
5 3646
hariharanmca
1,977 1GB
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

Expand|Select|Wrap|Line Numbers
  1. SELECT 
  2. Clinics.clinic_no,
  3. Clinics.Hosptl_no,
  4. Hospitals.Hosptl_no,
  5. Hospitals.hosptl_name
  6. FROM Clinics
  7. INNER JOIN Hospitals ON Clinics.Hosptl_no = Hospitals.Hosptl_no
  8.  
you can try this

Expand|Select|Wrap|Line Numbers
  1. insert into NewTableName (Field1, Field2, Field3, Field4) SELECT 
  2. Clinics.clinic_no,
  3. Clinics.Hosptl_no,
  4. Hospitals.Hosptl_no,
  5. Hospitals.hosptl_name
  6. FROM Clinics
  7. INNER JOIN Hospitals ON Clinics.Hosptl_no = Hospitals.Hosptl_no
Jul 17 '07 #2
ak1dnar
1,584 Expert 1GB
Thanks a bunch hariharanmca.
Jul 17 '07 #3
hariharanmca
1,977 1GB
Thanks a bunch hariharanmca.

You are most welcome moderator
Jul 17 '07 #4
ak1dnar
1,584 Expert 1GB
You are most welcome moderator
Mod for PHP-Forum not to here :)
Jul 17 '07 #5
hariharanmca
1,977 1GB
Mod for PHP-Forum not to here :)
okay, No problem...cool
Jul 17 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by vojtech | last post: by
19 posts views Thread by davidgordon | last post: by
reply views Thread by igendreau | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.