Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incidencia - EDA - Error SQL usuarios no administradores. #197

Open
PaulaaSTIC opened this issue Jul 19, 2024 · 0 comments
Open

Incidencia - EDA - Error SQL usuarios no administradores. #197

PaulaaSTIC opened this issue Jul 19, 2024 · 0 comments
Assignees
Labels
bug Something isn't working EDA Exclusivo de EDA

Comments

@PaulaaSTIC
Copy link
Collaborator

Si un usuario no administrador intenta ejecutar la consulta1, se produce el error Not allowed table in query. Sin embargo, la consulta2 se ejecuta sin incidencias. La única diferencia entre ambas consultas es el acceso a la tabla sda_l_stic_payment_commitments_payment_type_stic_payments_types_.

  • Consulta 1
DATE_FORMAT(DATE_ADD(DATE_ADD(LAST_DAY(CURRENT_DATE()), INTERVAL 1 DAY), INTERVAL numbers.n-1 MONTH), '%Y-%m') AS Mes,   
   `sda_l_stic_payment_commitments_payment_type_stic_payments_types_`.`value` as `Tipo de pago`  ,    
   sum(CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(spc.expected_payments_detail, '|', numbers.n), '|', -1) AS DECIMAL(10,2))) AS Importe
FROM 
   (
       SELECT 1 AS n UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL
       SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL
       SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL
       SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12
   ) AS numbers
CROSS JOIN 
   sda_stic_payment_commitments spc
 LEFT JOIN `sda_l_stic_payment_commitments_payment_type_stic_payments_types_` ON  spc.`payment_type` = `sda_l_stic_payment_commitments_payment_type_stic_payments_types_`.`code`    
WHERE 
   numbers.n <= (LENGTH(spc.expected_payments_detail) - LENGTH(REPLACE(spc.expected_payments_detail, '|', ''))) + 1
   AND SUBSTRING_INDEX(SUBSTRING_INDEX(spc.expected_payments_detail, '|', numbers.n), '|', -1) != '0'
group by `Mes`, `Tipo de pago`
ORDER BY 
   numbers.n

  • Consulta 2:
DATE_FORMAT(DATE_ADD(DATE_ADD(LAST_DAY(CURRENT_DATE()), INTERVAL 1 DAY), INTERVAL numbers.n-1 MONTH), '%Y-%m') AS Mes,   
    sum(CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(spc.expected_payments_detail, '|', numbers.n), '|', -1) AS DECIMAL(10,2))) AS Importe
FROM 
    (
        SELECT 1 AS n UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL
        SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL
        SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL
        SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12
    ) AS numbers
CROSS JOIN 
    sda_stic_payment_commitments spc
WHERE 
    numbers.n <= (LENGTH(spc.expected_payments_detail) - LENGTH(REPLACE(spc.expected_payments_detail, '|', ''))) + 1
    AND SUBSTRING_INDEX(SUBSTRING_INDEX(spc.expected_payments_detail, '|', numbers.n), '|', -1) != '0'
group by `Mes`
ORDER BY 
    numbers.n


@PaulaaSTIC PaulaaSTIC added bug Something isn't working EDA Exclusivo de EDA labels Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working EDA Exclusivo de EDA
Projects
None yet
Development

No branches or pull requests

2 participants