0
How do I query two tables at once? I have two table structures as follows.
TGFCAB
___________________
|NUNOTA| DTMOV |
------------------|
| 1 |01/06/2019|
| 2 |02/06/2019|
| 3 |03/06/2019|
and
TGFITE
|NUNOTA|CODPROD|QTDNEG|VLRUNIT |VLRTOTAL|
|------|-------|------|--------|--------|
| 1 | 18 |5,2 |10 |52 |
| 1 | 26 |1,3 |10 |13 |
| 2 | 11 |10,5 |10 |105 |
| 2 | 26 |16,5 |10 |165 |
| 2 | 18 |2,5 |10 |250 |
| 3 | 18 |2,0 |10 |200 |
In the case I made a SELECT in the first table, to look for the values of the day 01/06/2019 and 02/06/2019, was as follows.
SELECT * FROM TGFCAB
WHERE DTMOV
BETWEEN
to_date('01-JUN-19', 'dd-mon-yy')
AND
to_date('02-JUN-19', 'dd-mon-yy')
ORDER BY DTMOV;
I now need to automatically pick up only tax bills 1 and 2, which are respectively from days 1 and 2. Is there any way to do this without having to type manual?
A junction between the two tables via NUNOTA field? An INNER JOIN will provide what you need.
– anonimo