I have this table:

```
╔═════╤═══════╤═══════╗
║ ID  │ Group │ Value ║
╠═════╪═══════╪═══════╣
║ ID1 │ 1     │ 10    ║
╟─────┼───────┼───────╢
║ ID2 │ 1     │ 5     ║
╟─────┼───────┼───────╢
║ ID2 │ 1     │ 4     ║
╟─────┼───────┼───────╢
║ ID2 │ 1     │ 6     ║
╟─────┼───────┼───────╢
║ ID1 │ 2     │ 1     ║
╟─────┼───────┼───────╢
║ ID2 │ 2     │ 7     ║
╟─────┼───────┼───────╢
║ ID2 │ 2     │ 8     ║
╟─────┼───────┼───────╢
║ ID2 │ 2     │ 3     ║
╟─────┼───────┼───────╢
║ ID3 │ 3     │ 6     ║
╟─────┼───────┼───────╢
║ ID2 │ 3     │ 4     ║
╟─────┼───────┼───────╢
║ ID2 │ 3     │ 1     ║
╟─────┼───────┼───────╢
║ ID2 │ 3     │ 9     ║
╚═════╧═══════╧═══════╝

```

I want to do the following:

1. Find all Groups where ID = ID1
2. Extract the average values of ID2 belonging to the same group as ID = ID1

ID1 is only found in Group1 and Group2. Therefore the average of ID2 in
Group1 = (5+4+6)/3 = 5

and Group2 = (7+8+3)/3 = 6

3. Calculate the percent of the value of ID1 relative to the average of ID2 for each group.

Group1 = (10\*100%)/5 = 200%

Group2 = (1\*100%)/6 = 16%

I know how to do the steps separately but I don't know how I can use the list of the first queries (the groups) in the second query.

Search\_Item = 'ID1'

```
Select Group FROM MyTable WHERE ID = 'ID1'

```

-> Return 1 and 2

```
Select AVG(Value) FROM MyTable WHERE ID = 'ID2' AND Group = '1' 
Select AVG(Value) FROM MyTable WHERE ID = 'ID2' AND Group = '2'

```

Any help would be very appreciated.