Last active
January 22, 2019 13:03
-
-
Save Unison1/6c8030bf66ac621397f3cd99155b7ef6 to your computer and use it in GitHub Desktop.
WhatsApp_search_for_number_calls.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM( | |
SELECT SUBSTR(mes.key_remote_jid, 1,12) AS [Контакт], DATETIME(SUBSTR(cal.timestamp , 1,10), 'unixepoch', 'localtime') AS [Дата], | |
TIME(cal.duration,'unixepoch') AS [Продолжительность], CASE mes.key_from_me | |
WHEN "1" THEN 'Набранный' | |
WHEN "0" THEN 'Принятый' | |
END AS [Тип] | |
FROM call_logs cal | |
JOIN messages mes ON mes._id = cal.message_row_id | |
Union all | |
SELECT SUBSTR(mes.key_remote_jid, 1,12) AS [Контакт], DATETIME(SUBSTR(mcall.timestamp , 1,10), 'unixepoch', 'localtime') AS [Дата], | |
"00:00:00" as [Продолжительность],"Пропущенный" AS [Тип] | |
FROM missed_call_logs mcall | |
JOIN messages mes ON mes._id = mcall.message_row_id | |
) WHERE Контакт = '380*********' | |
ORDER BY Дата ASC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment