How to use join in Postgrest

0

I have the Table A:

-------------------
*    fechaA       *
-------------------
* 2017-09-01      *
* 2017-09-02      *
* 2017-09-03      *
* 2017-09-04      *
* 2017-09-05      *
* 2017-09-06      *
* 2017-09-07      *
* 2017-09-08      *
* 2017-09-09      *
* 2017-09-10      *
-------------------

And the Table B

-------------------
*    fechaB       *
-------------------
* 2017-09-01      *
* 2017-09-06      *
* 2017-09-10      *
-------------------

And I have the following query:

SELECT fechaA       
FROM TABLA_A
WHERE fechaA NOT IN (SELECT FechaB FROM TABLA_B)

What is the difference of A in B

The Result is:

-------------------
*    Resultado    *
-------------------
* 2017-09-02      *
* 2017-09-03      *
* 2017-09-04      *
* 2017-09-05      *
* 2017-09-07      *
* 2017-09-08      *
* 2017-09-09      *
-------------------
  

The problem is that the query is longer than the one I show and I would like to make it more efficient with a join , the fact is that I do not know how to do it. I appreciate your help.

    
asked by Shassain 16.04.2018 в 05:21
source

1 answer

0
SELECT a.fechaA
FROM TABLA_A a
LEFT JOIN TABLA_B b ON a.fechaA = b.fechaB
WHERE b.fechaB IS NULL

Reference: link

    
answered by 16.04.2018 в 05:48