how to make a difference in mysql?

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      *
-------------------

What I need is the difference of A in B

The Serious result

-------------------
*    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 I do not know how to do it try with fechaA!=FechaB but still the result is the whole table A

    
asked by Shassain 18.09.2017 в 17:05
source

1 answer

2

Have you tried with a not in?

something like:

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

This what it does is to find the equal dates that are in A, with those that do not appear in B, then only bring those.

    
answered by 18.09.2017 / 17:14
source