I have a table which contains the following data :-
loc_id id val
730 450 1
730 250 2
730 350 2
730 251 3
730 351 4
730 451 3
I need to show the data as
for each loc_id dependant for certain id's
The value contains the group and for others the
val is to be added together e.g.
loc_id Val1 Val2
730 1 3 = 450 = 451
730 2 7 = 250&350 are the same so = 251+351
val1 = the values within id's 450,250,350 grouped by the values
val2 = the values within id's 451,251,351 added together
dependant upon the grouping of the values within val1
If anyone could help I would eternally be in awe of their
SQL prowess.
Thanks in advance for any help with this problem.
Dave.
loc_id id val
730 450 1
730 250 2
730 350 2
730 251 3
730 351 4
730 451 3
I need to show the data as
for each loc_id dependant for certain id's
The value contains the group and for others the
val is to be added together e.g.
loc_id Val1 Val2
730 1 3 = 450 = 451
730 2 7 = 250&350 are the same so = 251+351
val1 = the values within id's 450,250,350 grouped by the values
val2 = the values within id's 451,251,351 added together
dependant upon the grouping of the values within val1
If anyone could help I would eternally be in awe of their
SQL prowess.
Thanks in advance for any help with this problem.
Dave.