Projekt

Obecné

Profil

Podání #46037

otevřený

Info o neodeslanych SMS - asi spatna cisla

Přidáno uživatelem Andrej Ramašeuski před 25 dny(ů). Aktualizováno před 25 dny(ů).

Stav:
V řešení (diskutuje se)
Priorita:
Normální
Přiřazeno:
Kategorie:
-
Začátek:
29.01.2025
Uzavřít do:
% Hotovo:

90%

Odhadovaná doba:

Aktualizováno uživatelem Andrej Ramašeuski před 25 dny(ů)

  • Stav změněn z Nový na V řešení (diskutuje se)
  • % Hotovo změněn z 0 na 90
create view octopus_users_view as select 
 * from dblink(
   'dbname=octopus', 
   'SELECT 
     id, 
     username_clean, 
     official_last_name, 
     official_first_name, 
     ''+420'' || REGEXP_REPLACE( REGEXP_REPLACE(REGEXP_REPLACE(phone, ''^(00420|[^0-9]*420)'', ''''), ''[^0-9]'', '''', ''g''),''^00'', '''') from people_person'
   )  
   AS t1(id integer, username text, firstname text, lastname text, phone text);

create view "failed_messages_view" as select 
 number,
 octopus_users_view.username, 
 octopus_users_view.firstname, 
 octopus_users_view.lastname, 
 count(*) from history 
 left join octopus_users_view on 
 (octopus_users_view.phone=number) 
 where status = 'failed' and ts>'2024-01-01' 
 group by (
   number,
   octopus_users_view.username,
   octopus_users_view.firstname, 
   octopus_users_view.lastname 
 ) 
 order by count(*) 
desc;

grant select on failed_messages_view to "nocodb-view";

Také k dispozici: Atom PDF