SQL query

From: <gcb45_at_dial.pipex.com>
Date: 1999/04/08
Message-ID: <370ccf00.98505429_at_news.dial.pipex.com>#1/1


I am looking for some assistance with a SQL query. I have a table within my application called USERICONS, containing the following fields:
usercode sequenceno bitmapint trancode description st              

I have another table called USERROLES, containing the following fields:
usercode rolecode
st ST
I have a user called 'st' which has 19 icons. I would like to be able to give all users with the rolecode ST the same icons that 'st' has. This is where I hit a problem.

If there was one user I would use the following SQL: insert into usericons (usercode, sequenceno, bitmapint, trancode, description)
(select '&usercode', sequenceno, bitmapint, trancode, description from USERICONS
where usercode = 'st');

So, if I entered a user named 'jh1' when prompted by '&usercode', all of 'st' data will be inserted into the USERICONS table but with the new username.
BUT, how can I do this for a list of users. My query: select usercode from USERICONS
where rolecode = 'ST';
gives me the list of users, I just don't know how to incorporate this into the above query.

Any help would be appreciated, I'm sure there is some simple answer somewhere :)

thanks
Gary Received on Thu Apr 08 1999 - 00:00:00 CEST

Original text of this message