Record in Maintable with Only INSERT Command

I have 3 table.
UserTable(id,username)
Permission(pid,pertype)
MainTable(autoid,username,pertype)

Usertable and Permission table are having record.
I want to put that record in the Maintable with only INSERT command.
How I would do it?

Here is your answer:

  first get the records from the UserTable and Permission using
  ResultSet rs=......executeQuery("select * from UserTable");
  while(rs.next())
  {

  }

and 

  insert those things using
  PreparedStatement pr=con.PrepareStatement("insert into mainTable values(?,?,?)");
  pr.setString(1,variblename);
  pr.setString(2,variblename);
  pr.setString(3,variblename);

  pr.executeUpdate();

  }

finish

Do you have a Java Problem?
Ask It in The Java Forum

Java Books
Java Certification, Programming, JavaBean and Object Oriented Reference Books

Return to : Java Programming Hints and Tips

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site www.erpgreat.com is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.