Hi,
I've having a bit of difficulty with an update statement.
The following select statement returns 34 records...
select b.* from budget as b
inner join ntime t on b.feeearnerkey=t.feeearnerkey
inner join date d on t.datekey=d.datekey
inner join acts a on t.activitykey=a.activitykey
where a.activitycode in (11,12,13,14,15,16,17,18)
and b.fiscalmonth=d.fiscalmonthnum
and b.fiscalyear=d.fiscalyearnum
and b.budgetkey=1
and t.feeearnerkey=520
If I add a distinct clause to the statement, only 9 records are returned from the budget table.
I'm attempting to update the budget table 34 times, which means updating the same record from the budget table multiple times in the same update statement.
I've tried variations of the update statement, but only 9 records are ever updated.
update budget as b
inner join ntime t on b.feeearnerkey=t.feeearnerkey
inner join date d on t.datekey=d.datekey
inner join acts a on t.activitykey=a.activitykey
set b.budgetamount=b.budgetamount - (t.minutes / 60)
where a.activitycode in (11,12,13,14,15,16,17,18)
and b.fiscalmonth=d.fiscalmonthnum
and b.fiscalyear=d.fiscalyearnum
and b.budgetkey=1
and t.feeearnerkey=520
update time t
inner join budget b on t.feeearnerkey=b.feeearnerkey
inner join date d on t.datekey=d.datekey
inner join acts a on t.activitykey=a.activitykey
set b.budgetamount=b.budgetamount - (t.minutes / 60)
where a.activitycode in (11,12,13,14,15,16,17,18)
and b.fiscalmonth=d.fiscalmonthnum
and b.fiscalyear=d.fiscalyearnum
and b.budgetkey=1
and t.feeearnerkey=520
Can anyone give any advice on how to go about updating the 34 records in one update statement.
Many Thanks!
:)