I tried my best, but I'm not able to deal with this :) I have two tables, I try to compare the AVG Data from Table one with the Data2 from Table2.
Table1
| Name | Data |
|---|---|
| AA | 1 |
| AA | 5 |
| AA | 10 |
| AB | 10 |
| AB | 50 |
| AB | 100 |
AVG AA = 5.333... AVG AB = 53.333...
Table2
| Name2 | Data2 |
|---|---|
| AA | 4 |
| AB | 50 |
The output I want:
| Name | Data | Name2 | Data2 |
|---|---|---|---|
| AA | 5.333... | AA | 4 |
| AB | 53.333 | AB | 50 |
I tried something like this...
SELECT (SELECT AVG(Data) FROM Table1) AS AVGData, (SELECT Name FROM Table1) AS Name, Table2.*, FROM "Table2"
GROUP BY Table2.Name