Hello,
I'm trying to "translate" in EF core this SQL query:
SELECT * FROM Estrazioni WHERE Estrazioni.DataEstrazione = (SELECT MAX(maxEstrazione.DataEstrazione) FROM Estrazioni AS maxEstrazione)
I have tried to write this, copying from internet, but I receive a lot of error that I don't understand:
var ultimaEstrazione = await _context.Estrazioni
.Where(e => e.DataEstrazione == Convert.ToDateTime(_context.Estrazioni.Where(w => w.DataEstrazione == e.DataEstrazione).MaxAsync(w => w.DataEstrazione)))
.Select(e => new { e.DataEstrazione, e.Estrazione01 });Could someone please help me to write the right code?
Thank you