Specific filtering with Mysql

Asked

Viewed 19 times

0

Hello, my friends.

I have a mysql database,

and I’m making some appointments

I want to know how I can do a very specific filtering.

For example, I have a database:

+--------+------------+----------+-------------+
| callId | callDay    | callTime | disposition |
+--------+------------+----------+-------------+
|      7 | 2020-12-18 | 08:00:00 | ANSWERED    |
|      8 | 2020-12-18 | 08:00:00 | NO ANSWER   |
|      9 | 2020-12-18 | 08:00:00 | BUSY        |
|     10 | 2020-12-18 | 09:00:00 | ANSWERED    |
|     11 | 2020-12-18 | 09:00:00 | NO ANSWER   |
|     12 | 2020-12-18 | 09:00:00 | BUSY        |
|     13 | 2020-12-18 | 10:00:00 | ANSWERED    |
|     14 | 2020-12-18 | 10:00:00 | NO ANSWER   |
+--------+------------+----------+-------------+

In the case of this example database, I want to collect all records, but I want to omit the repeated values within the "callTime" column, or print only the "callTime" records in which there are more fields according to the "disposition" column, this is possible?

Gostaria que saída fosse mais ou menos assim:
+--------+------------+----------+-------------+
| callId | callDay    | callTime | disposition |
+--------+------------+----------+-------------+
|      7 | 2020-12-18 | 08:00:00 | ANSWERED    |
|      8 | 2020-12-18 |          | NO ANSWER   |
|      9 | 2020-12-18 |          | BUSY        |
|     10 | 2020-12-18 | 09:00:00 | ANSWERED    |
|     11 | 2020-12-18 |          | NO ANSWER   |
|     12 | 2020-12-18 |          | BUSY        |
|     13 | 2020-12-18 |          | ANSWERED    |
|     14 | 2020-12-18 | 10:00:00 | NO ANSWER   |
+--------+------------+----------+-------------+
  • Could you give an example of the expected output?

  • I added it to the question, but now that I’m seeing better, I think what I’m trying to do is kind of stupid. Still, it would be possible to do?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.