Skip to content
Advertisement

Update one table based upon SUM(values) in another table on multiple criteria

I can’t seem to find out how to do this and not sure exactly how to search for it!

I have a table [MASTER]:

and another table [FOOS]

MASTER contains one row per ID/CCY composite key (not sure if thats correct term) e.g.

FOOS contains multiple rows and DOES NOT contain a row for every MASTER e.g.

I’d like to run a query to update only matching MASTER rows with SUM(FOOS.Val). e.g.

…but although I’ve tried a numer of options (where exists, inner join) I can’t seem to be able to either link to a single MASTER or do the SUM(...)

Advertisement

Answer

Try this solution:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement