How to used exists and not exists query condition in mysql sql Database

Description

How to used DISTINCT in Exist and not Exist SQL MySQL oracle Database query. How to Compare three columns in MySQL SQL oracle Database query. Why used exist and not exist SQL MySQL oracle Database query condition.

How to Compare more than two columns in MySQL SQL oracle Database query. How to Compare three columns. How to Compare two and three columns.

Advantages of EXISTS and not exist query in MySQL

Main Advantages of EXISTS query is solved the three condition in one query 

For example 

For columns in database

1) current Date

2) Next Date

3) Call Agent

4) Phone number

Now I want remaining or pending call list work for particular Call Agent. In case we can compare Next Date (Phone number) for current Date (Phone number). Now, this type condition solved with EXISTS and not exist query.

because now, in this case, we can not use if condition and where condition due to in if condition case Compare two columns and one column.

EXISTS and not exist query

SELECT cr1.phoneno FROM callcomment AS cr1 WHERE calldateup = '$prev_date' AND callidnext = '$datetime' AND NOT EXISTS ( SELECT phoneno FROM callcomment cr2 WHERE cr2.calldateup = '$datetime'  AND cr2.phoneno = cr1.phoneno ) LIMIT 0 , 30

 SELECT cr1.phoneno FROM checkrow as cr1 WHERE calldateup = '2017-02-04'  and  callidnext = '2017-02-05' and NOT exists (  select phoneno from checkrow cr2 where cr2.calldateup = '2017-02-05' )

1 How to used DISTINCT in Exist and not Exist SQL MySQL oracle Database query.

SELECT DISTINCT(cr1.phoneno )  FROM checkrow as cr1 WHERE calldateup = '2017-02-04' and callidnext = '2017-02-05'  and NOT exists ( select phoneno from checkrow cr2 where cr2.calldateup = '2017-02-05' AND cr2.phoneno = cr1.phoneno )