I have a query I am running on two Tables (Table Customer and Table Vendor). On Table Customer I may have multiple rows of similar records. I am joining the two tables using the parameters below, however I noticed instances of Table Vendor Id duplicates in the query result. I am guessing this is because I have multiple similar records on Table Customer. Please can someone assist me with the right query to use to get distinct ID values on the join? Note that I am using this on entity framework core for a project. See query used on entity framework converted to sql below
SQL
select distinct * from Vendor e inner join Customer d on e.account = d.Cod_account
where (e.ActionStatus = 'Pending' and d.ActionStatus = 'Pending') and (d.Amt = e.Amount)
and (e.UploadTime = '05:00pm') and (e.Uploaddate = d.Calldate) order by d.Amt desc
ENTITY FRAMEWORK
await (from e in _dbc.Vendor join d in _dbc.Customer on e.account equals d.Cod_account
where (e.ActionStatus == "Pending" && d.ActionStatus == "Pending") && (d.Amt == e.Amount)
&& (e.UploadTime == uploadtime) && (e.Uploaddate == d.Calldate)
orderby d.Amt descending
select new CustomerVend
{
Customer = d,
Vendor = e
}).Take(2000).Distinct().ToListAsync();