0

Dear StackOverflow Community,

i have two tables users and USERQueries
tables]

My requirement is to write a query in oracle
"which fetch userids from users table & insert into USERQueries table"

I am able to insert one userid as below

 insert into  USERSQUERIES  
(APP,CLAUSENAME,USERID,DEFAULTQUERYID,OWNER)   
values   
('SR','Assgined_SRs_To_Me',(select userid from USERS where  groupname='IBMSDL2S' and userid='1249
),DEFAULTQUERYSEQ.NEXTVAL,'MAXADMIN')

but didn't understand how it will work for all userids ,
and userids shouldnt repeat.
kindly help

APC
  • 144,005
  • 19
  • 170
  • 281
Nisha Verma
  • 91
  • 2
  • 12
  • 1
    Please don't put your details in images - please edit your question to add your tables and data as text. There are those of us who can't see images due to firewall restrictions, etc, and it makes it harder than it should be to set up our own test case with your data. – Boneist Feb 20 '20 at 12:30

1 Answers1

0

That depends on tables' description, but - generally speaking, you'd

insert into userqueries 
  (app, 
   clausename, 
   userid)
select app, 
       clausename, 
       userid
from users
where ...
Littlefoot
  • 131,892
  • 15
  • 35
  • 57