Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: help with SQL query

Re: help with SQL query

From: Arlette BROSSARD <abray_at_club-internet.fr>
Date: 8 Apr 1999 21:41:40 GMT
Message-ID: <01be8208$f5476a40$47a224c3@ntdv2113>


You can use a joint between USERROLES and USERICONS in the SELECT query

Try :

INSERT INTO usericons

     SELECT a.usercode,b.sequenceno,b.bitmapint,b.transcode,b.description
       FROM userroles a,usericons b
      WHERE a.usercode <> b.usercode
        AND b.usercode = 'st'
        AND a.rolecode = 'ST';


gcb45_at_dial.pipex.com a écrit dans l'article <370cd2c6.99470985_at_news.dial.pipex.com>...
> 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 - 16:41:40 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US