views:

414

answers:

1

I have:

select distinct to_date(to_char(i.fe_stax, 'DD/MM/YYYY'), 'DD/MM/YYYY') FechaProg, a.id_ciud, t.no_ciud from itinerario i
where to_date(to_char(i.fe_stax, 'DD/MM/YYYY'), 'DD/MM/YYYY') is not null

I want something like this?

var tmp = (from itin in db.ITINERARIO
                      where itin.FE_STAX != null
                      select new { 
                          FechaProg = itin.FE_STAX.Value, IdCiud = itin.EMPRESA_AEROPUERTO.AEROPUERTO.TTCIUD.CO_CIUD, 
                          NoCiud = itin.EMPRESA_AEROPUERTO.AEROPUERTO.TTCIUD.NO_CIUD
                      }).Distinct();

but I do not format the date column to apply DISTINCT

+1  A: 

The problem is you are applying distinct not on a date column here but on an anonymous type - this will never work as the type has no concept of equality as it has not been defined for this type.

DamienG