-1
I am trying to develop a code to create dynamic tables with php and mysql, using an Asterisk database. My first difficulty is that the recording of calls are duplicated (or quadrupled), if the connection is internal. For example, if I use the command:
SELECT calldate, src, dst, duration, disposition
FROM cdr
ORDER BY calldate DESC
LIMIT 8;
This result is obtained:
+---------------------+------+------+----------+-------------+
| calldate | src | dst | duration | disposition |
+---------------------+------+------+----------+-------------+
| 2020-12-15 08:43:27 | 5003 | 5010 | 505 | ANSWERED |
| 2020-12-15 08:42:32 | 5001 | 5006 | 34 | ANSWERED |
| 2020-12-15 08:41:42 | 5001 | 5006 | 34 | ANSWERED |
| 2020-12-15 08:39:15 | 5006 | 5010 | 34 | ANSWERED |
| 2020-12-15 08:38:26 | 5006 | 5010 | 34 | ANSWERED |
| 2020-12-15 08:36:30 | 5001 | 5008 | 36 | ANSWERED |
| 2020-12-15 08:36:06 | 5004 | 5001 | 0 | BUSY |
| 2020-12-15 08:35:46 | 5004 | 5001 | 20 | BUSY |
+---------------------+------+------+----------+-------------+
8 rows in set (0.09 sec)
How can I get around that?
SELECT DISTINCT src, dst, ...
– user60252
The table you posted in the question has no duplicate records. Duplicated would be if all the data of a record (line) were equal to those of another line. As the calldates are all different, there is no duplication of records.
– Piovezan