Suppose I have two tables name company and screensavers as given below:
**Company:** id (pk auto inc) name (varchar) **ScereenSavers:** id (pk auto inc) name (varchar) path (varchar) company_id (int) # This is pk of Company
Now I want to Select each company and add 3 records which means every single company's
pk will be saved as
screensaver table for the given number of users. How can I doe this by writing something like:
SELECT id AS c_id From company INSERT INTO screen_savers VALUES ( name='Screen Saver-I', path='screen_save_i_path', company_id=c_id ),( name='Screen Saver-II', path='screen_save_ii_path', company_id=c_id ),( name='Screen Saver-III', path='screen_save_iii_path', company_id=c_id )
I don't know above will work, but I want to give some idea what I wanted to do. Can someone please let me know the solution? I am using Postgresql.