Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: SQL Insert question
iashraf_at_csc.com wrote:
>
> Hi ,
>
> this is puzzling me..
>
> i have following table
>
> table name = Sierras.
> Columns =
> regno,
> platfrom,
> cost ,
> licence_ref
> renewal_data
>
> i split this table up into 2:
>
> 1. Softwares
> cols=
> id,
> regno,
> platfrom,
>
> 2. Licences
> id,
> cost ,
> licence_ref,
> renewal_data,
>
> i have a third table, a link table between softwares and licences
>
> cols=
> id,
> licence_id,
> software_id
> i want to populate this table with the ids from softwares and licences, so
> that if joined together 1 row would reflect a row in the old table sierras.
> What query can i write for this??
>
> hope all that makes sense!
>
> regards
> IA
>
insert into link_table (licence_id, software_id)
select l.id, s.id
from softwares s,
licences l, sierras o where l.licence_ref = o.licence_ref and l.renewal_data = o.renewal_data
I don't see why you need any 'id' column in the link table.
-- Regards, Stephane Faroult Oriole Ltd -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Stephane Faroult INET: sfaroult_at_oriole.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Thu Feb 07 2002 - 09:18:57 CST