• Sat. Apr 20th, 2024

Type Own

Type Own a global information analytics business that helps institutions and professionals progress science, advance healthcare and improve performance.

checklist values ​which can be duplicated greater than 4 instances

Byadmin

Dec 23, 2021


I’m making a be part of between 2 tables, the place they convey me number_phone which have a relationship and I carry the instances that these are repeated, nonetheless, I’m making an attempt to make a situation to the rely, in order that it solely lists these which can be repeated greater than 4 instances, I attempted with having account and it brings me the counter all in null. It’s value mentioning that I didn’t occupy group by for the rely as a result of it introduced me unsuitable values.

SELECT
    REPLACE(REPLACE(t.id_contrato,'0999',''),'0998','')as contrato , 
    t.num_telefono,
    conc.valor_actual,
    (
        SELECT COUNT('x') 
        FROM TBL_TELEFONO ct 
        WHERE ct.num_telefono = t.num_telefono
        AND ct.origen_tel='TELEFONO CONTRATO' 
        
    ) as counter 
FROM TBL_TELEFONO t
INNER JOIN  CAM_TBL_ALERTA_CONCENTRADO conc ON t.num_telefono = conc.valor_actual 
WHERE id_contrato IS NOT NULL
AND id_contrato NOT IN ('N/A')
ORDER BY 4 DESC

How can I checklist solely these which can be repeated greater than 4 instances?

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *

Exit mobile version