I have table Products where I store my products and another table Votes which cointains user votes for that products.
Product:
ID
Name
Price
etc..
Votes:
ID
ProductID
IpAdress
DateTimeCreated
How would I get most voted products in last 24 hours in linq to sql? I’m really not that good with L2S to figure it on my own.
This is closest I got so far, this snippet should get last 10 voted, but I need top voted in last 24h:
var last10Voted = (from vote in context.Votes join product in
context.Products on vote.ProductID equals
product.ID orderby vote.DateTimeCreated select product).Take(10);
Product:
ID
Name
Price
etc..
Votes:
ID
ProductID
IpAdress
DateTimeCreated