none
Pasar sentencia SQL con funciones agregadas a LINQ RRS feed

  • Pregunta

  • Me podrian ayudar a pasar esta sentencia a LINQ:

    Select T1.NU_CONT, T1.CO_bASE, T1.DE_BASE, T1.TI_BASE_DESC, T1.IM_DESC, T1.PC_DESC
    From (
     Select count(t2.CO_BASE) NU_CONT, t2.CO_BASE CO_BASE, max(t2.DE_BASE) DE_BASE,
            max(t1.TI_BASE_DESC) TI_BASE_DESC, max(t1.IM_DESC) IM_DESC, max(t1.PC_DESC) PC_DESC
     From BD1.TDDEJU_BASE t1, BD1.TTTIPO_BASE t2
     Where t1.ID_TRAB_EMPR =  'VARIABLE_ID_TRAB_EMPR'
     And   t1.NU_CORR_DCJU = 'CAMPO_NU_CORR_DCJU'
     And   t2.CO_BASE = t1.CO_BASE
     Group By T2.CO_BASE
     UNION ALL
     Select 0, t4.CO_BASE CO_BASE, t4.DE_BASE DE_BASE, NULL TI_BASE_DESC, NULL IM_DESC, NULL PC_DESC
     From BD1.TTTIPO_BASE t4
     Where t4.CO_BASE not in (SELECT t3.CO_BASE
                              From BD1.TDDEJU_BASE t3
                              Where t3.ID_TRAB_EMPR = 'VARIABLE_ID_TRAB_EMPR'
                                And t3.NU_CORR_DCJU = 'CAMPO_NU_CORR_DCJU')
                                and t4.ST_AFEC_RTJU = 'S'
                              UNION ALL
                              Select count(t1.CO_BASE) NU_CONT, t1.CO_BASE CO_BASE,
                              'DATOS ADICIONALES' DE_BASE, max(t1.TI_BASE_DESC) TI_BASE_DESC,
                               max(t1.IM_DESC) IM_DESC, max(t1.PC_DESC) PC_DESC
                              From BD1.TDDEJU_BASE t1
                              Where t1.ID_TRAB_EMPR = 'VARIABLE_ID_TRAB_EMPR'
                              And t1.NU_CORR_DCJU = 'CAMPO_NU_CORR_DCJU'
                              And t1.CO_BASE = 'DAL'
     Group By T1.CO_BASE) t1
    order by 2

    Gracias,

    Rosa.

     

    martes, 25 de enero de 2011 21:02