We have a budgeting table and a budgetAssistant table, I have 3 employee ID's,
I need to assign each of them as budget assistant. Do you know of a quick
update query I could write to accomplish this? The budget and
budgetAssistant tables both have a budgetID field. Any ideas?
I wanted to select those employees, then select all the budget then loop
through and add those 3 to each budget as a budgetAssistant.
Thanks,
~CKPerhaps if you included a bit more information, a psuedo example of
information in the tables would help a little.
CK wrote:
Quote:
Originally Posted by
Hi All,
>
We have a budgeting table and a budgetAssistant table, I have 3 employee ID's,
I need to assign each of them as budget assistant. Do you know of a quick
update query I could write to accomplish this? The budget and
budgetAssistant tables both have a budgetID field. Any ideas?
>
I wanted to select those employees, then select all the budget then loop
through and add those 3 to each budget as a budgetAssistant.
>
Thanks,
>
~CK
INSERT budgetAssistant (budgetID, employee)
SELECT B.budgetID, Add3.employee
FROM budgeting as B CROSS JOIN
(select 123 as employee UNION ALL
select 345 UNION ALL
select 567) AS Add3
Roy Harvey
Beacon Falls, CT
On Tue, 24 Oct 2006 19:53:31 GMT, "CK" <c_kettenbach@.hotmail.com>
wrote:
Quote:
Originally Posted by
>Hi All,
>
>We have a budgeting table and a budgetAssistant table, I have 3 employee ID's,
>I need to assign each of them as budget assistant. Do you know of a quick
>update query I could write to accomplish this? The budget and
>budgetAssistant tables both have a budgetID field. Any ideas?
>
I wanted to select those employees, then select all the budget then loop
>through and add those 3 to each budget as a budgetAssistant.
>
>Thanks,
>
>~CK
>
I used this and it worked as well
INSERT INTO BudgetAssistant (BudgetID, EmployeeID)
SELECT * FROM (
SELECT BudgetID, EmployeeID FROM Budget, (
SELECT EmployeeID FROM TeamMember WHERE TeamID=96) A)tmp
"Roy Harvey" <roy_harvey@.snet.netwrote in message
news:mb6tj212ahvgci94m8m4a1nfo0vg361jre@.4ax.com...
Quote:
Originally Posted by
This might give you some ideas.
>
INSERT budgetAssistant (budgetID, employee)
SELECT B.budgetID, Add3.employee
FROM budgeting as B CROSS JOIN
(select 123 as employee UNION ALL
select 345 UNION ALL
select 567) AS Add3
>
Roy Harvey
Beacon Falls, CT
>
On Tue, 24 Oct 2006 19:53:31 GMT, "CK" <c_kettenbach@.hotmail.com>
wrote:
>
Quote:
Originally Posted by
>>Hi All,
>>
>>We have a budgeting table and a budgetAssistant table, I have 3 employee
>>ID's,
>>I need to assign each of them as budget assistant. Do you know of a quick
>>update query I could write to accomplish this? The budget and
>>budgetAssistant tables both have a budgetID field. Any ideas?
>>
>I wanted to select those employees, then select all the budget then loop
>>through and add those 3 to each budget as a budgetAssistant.
>>
>>Thanks,
>>
>>~CK
>>
No comments:
Post a Comment