Reputation: 835
I have this query and i wanted to only select distinct value from Charges table(Port Name must only display once).
public List<Port> GetPortsByCountryOrigin(int countryId, TransportDirection transdirection, TransportType transtype)
{
using (var ctx = CreateDbContext())
{
return (from item in ctx.Ports
join s in ctx.Charges
on item.PortId equals s.PortId
where (s.TransportDirection == transdirection &&
s.TransportType == transtype
&& item.CountryId == countryId)
select item).ToList();
}
}
Currently, the Ports.Name are repeating values.
Upvotes: 0
Views: 36