
create or replace view zoho_click_to_call.v_in_server_account_user as SELECT *
                                                                  FROM zoho_auth.server_account_user;

create or replace view zoho_click_to_call.v_in_zoho_user_account_alive as select * from zoho_auth.v_zoho_user_account_alive;



create or replace view zoho_click_to_call.v_btw_to_activate as select zoho_user_account_id  from zoho_click_to_call.v_in_zoho_user_account_alive WHERE
        v_in_zoho_user_account_alive.zoho_user_account_id  NOT IN (select zoho_user_account_id from zoho_click_to_call.url_enabler) AND zoho_user_account_id
        IN (
                                                                                                                                            SELECT id FROM v_in_zoho_user_account WHERE `is_active` = "Y" AND `is_active_clicktocall` = "Y"
                                                                                                                                        )  ;


create or replace view zoho_click_to_call.v_btw_to_disintegrate as  select zoho_user_account_id  from zoho_click_to_call.v_in_zoho_user_account_alive WHERE
        v_in_zoho_user_account_alive.zoho_user_account_id  IN (select zoho_user_account_id from zoho_click_to_call.url_enabler) AND zoho_user_account_id
        IN (
                                                                                                                                        SELECT id FROM v_in_zoho_user_account WHERE `is_active` = "N" OR `is_active_clicktocall` = "N"
                                                                                                                                    );


create or replace view zoho_click_to_call.v_in_zoho_user_account as select * from user_account_zoho.user_account;


