quiero hacer un select con where or where y estoy tratando de hacer de la siguiente manera, pero ya cuando ejecuto este método
public JsonResult JSONInfoFinTriMonths3()
{
using (DBEnt db = new DBEnt())
{
//Select(m => m.Name).Distinct();
var categorias = db.HomeInfoFinanciera.Where(s => s.month == 7 && s.month == 8 && s.month == 9);
return Json(categorias, JsonRequestBehavior.AllowGet);
}
}
Aquí tengo el query que me genera
SELECT
[Extent1].[id] AS [id],
[Extent1].[created_at] AS [created_at],
[Extent1].[lastupdate] AS [lastupdate],
[Extent1].[id_userCreated] AS [id_userCreated],
[Extent1].[tipo] AS [tipo],
[Extent1].[path] AS [path],
[Extent1].[year] AS [year],
[Extent1].[month] AS [month],
[Extent1].[day] AS [day]
FROM [dbo].[HomeInfoFinanciera] AS [Extent1]
WHERE [Extent1].[month] IN (7,8,9)
que justo me devuelve todos los datos que deseo.
Aquí estoy llamando al método
$.ajax({
url: "/Home/JSONInfoFinTriMonths3",
type: "GET",
dataType: "json",
//contentType: "application/json; charset=utf-8",
success: function (response) {
console.log(response)
//alert(response);
var resplength = response.length;
for (let i = 0; i <= resplength; i++) {
document.getElementById('months1div')
.innerHTML += `
<li data-filter=".filter-${response[i].year}">
${response[i].year}</li>
`;
}
},
error: function (jqXHR, textStatus, err) {
//$('#myModalLabel').append(`error: - ${err}`);
console.log(jqXHR);
console.log(textStatus);
console.log(err);
alert(jqXHR.responseJSON + "JSONInfoFinYears");
}
});
Pero obtengo el error
alert(jqXHR.responseJSON + "JSONInfoFinYears");
Where(s => s.month == 7 && s.month == 8 && s.month == 9)
se traduce enWHERE [Extent1].[month] IN (7,8,9)
?. Me lo podrías confirmar por favor.Where(s => s.month == 7 || s.month == 8 || s.month == 9)
?