Is this doable with one SQL query? There are two tables:
tblPerson
----------------
PersonId
PersonFirstName
PersonLastName
-> refPersonGroupId
|
|
| (linked by)
|
|
| tblPersonGroup
| ----------------
-> PersonGroupId
PersonGroupName
So tblPerson.refPersonGroupId references tblPersonGroup.PersonGroupId.
I would like to insert a new entry into tblPerson without doing a separate query to find out what refPersonGroupId should be. If I know the new entry's PersonFirstName, PersonLastName, and the PersonGroupName to which they belong, how can I insert the entry? Eventually I'd like to make this a stored procedure where the names and the PersonGroupName are the inputs.
Thanks!
tblPerson
----------------
PersonId
PersonFirstName
PersonLastName
-> refPersonGroupId
|
|
| (linked by)
|
|
| tblPersonGroup
| ----------------
-> PersonGroupId
PersonGroupName
So tblPerson.refPersonGroupId references tblPersonGroup.PersonGroupId.
I would like to insert a new entry into tblPerson without doing a separate query to find out what refPersonGroupId should be. If I know the new entry's PersonFirstName, PersonLastName, and the PersonGroupName to which they belong, how can I insert the entry? Eventually I'd like to make this a stored procedure where the names and the PersonGroupName are the inputs.
Thanks!