I have the following tables
Table 1
| Project | Currency | Amount1 |
|---|---|---|
| P1 | USD | 100 |
| P1 | EUR | 1500 |
| P2 | EUR | 300 |
Table 2
| Project | Currency | Amount2 |
|---|---|---|
| P1 | USD | 200 |
| P2 | EUR | 350 |
From these tables above , i want to be able to select Amounts from Table 1 but only for couples (Project , Currency) that exist in table 2 . So the result would be :
| Project | Currency | Amount2 |
|---|---|---|
| P1 | USD | 100 |
| P2 | EUR | 300 |
I already know how to achieve this using a left join :
SELECT T2.Project
,T2.Currency
,T1.Amount
FROM Table2 T2
LEFT JOIN TABLE1 T1
ON T1.Project = T2.Project
AND T1.Currency = T2.Currency
But i wonder if it's possible to put a where clause condition on a tuple , and having a query like this :
SELECT *
FROM T1
WHERE (Project,Currency) IN (SELECT DISTINCT ( Project,Currency) From Table1 )
For now running this query gives me table 1 as a result .
Thank's in advance for your help !