Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Need to left join table 2 to table 1 with showing value of Max(Type)
Table 1:
ID | Name |
1 | A |
2 | B |
3 | C |
Table 2:
ID | Type | Value |
1 | 25 | 50 |
1 | 26 | 60 |
1 | 27 | 70 |
1 | 28 | 50 |
1 | 29 | 40 |
2 | 25 | 56 |
2 | 26 | 67 |
2 | 27 | 46 |
2 | 28 | 45 |
2 | 29 | 23 |
3 | 25 | 35 |
3 | 26 | 46 |
3 | 27 | 45 |
3 | 28 | 87 |
3 | 29 | 90 |
Result:
ID | Name | Value | Type |
1 | A | 40 | 29 |
2 | B | 23 | 29 |
3 | C | 90 | 29 |
Hi @kppiee , I think you can use a double join with value and type, something like:
Load
ID,
Name
Resident Table1;
Left Join
Load
ID,
Max(Value) AS Value
Resident Table2
Group By ID;
Left Join
Load
ID,
Value,
Type
Resident Table2;
JG