nested subquerie

Results 1 to 2 of 2

Thread: nested subquerie

  1. #1
    Join Date
    Dec 1969

    Default nested subquerie

    I am creating a document managment system of sorts. I have one table that holds users [worker] and a table that holds document access records [documentAccess]. When i add a new document through a web form i request from the user if the default for the document should be access granted or denied. I need a SQL statement that requests all the users logon names from the user table and then does an insert into the documentAccess table to grant or revoke the document for each user. <BR><BR>I understand that the below statement would pull all the userID&#039;s back:<BR><BR>select userID from worker<BR><BR>and that this statment would do the insert:<BR><BR>insert into documentAccess values ("userID",documentRef,access)<BR><BR>I could solve the problem by putting all the userID&#039;s into an array in asp and then doing X loops to do the insert for each user. But is it possible to do this only using SQL (possibly nested quries) Many thanks in advance!

  2. #2
    Join Date
    Dec 1969

    Default RE: nested subquerie

    I think what you&#039;re after is:<BR><BR>INSERT INTO documentAccess<BR>SELECT * FROM worker WHERE ....<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts