Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Probably a Basic SQL question

Status
Not open for further replies.

SteveNinjaCoder

Technical User
Mar 29, 2005
1
US
Here is the problem, I got three tables,

tblAction
PK-ActionID
-ActionNames

tblComponent
PK-ComponentID
-ComponentNames

tblAction component
PK-ActionID
PK-ComponentID
-ActionNames
-ComponentNames

(The priamary keys are linked respectivly to their names)
I want to take tblAction.ActionID and tblComponent.ComponentID and Insert them into tblActionComponent based on the Specific values i choose. However I also want the names to come over too. So ActionName/ID and ComponentName/ID would show up on tblActionComponent. The input would look like this:

ActionID: 2 ComponentID: 4

=tblActionComponent=
ActionID: 2 ActionName: Bob ComponentID: 4 ComponentName:Jen

When i've been doing it i am just getting empty fields
any help would be great.

Thanks.

Steve-Ninja-Coder!
 
Something like this ?
INSERT INTO tblActionComponent (ActionID,ComponentID,ActionNames,ActionNames)
SELECT ActionID,ComponentID,ActionNames,ActionNames
FROM tblAction,tblComponent
WHERE ActionID=2 AND ComponentID=4

But why denormalizing your database by storing derived values ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top