Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

convert select query to linq on sql server 2008

I have two tables: Album(AlbumId, AlbumName) and Photo(PhotoId, PhotoName, AlbumId)

I have :

 select top 1 Photo.PhotoId
 from Photo
 where Album.AlbumId=Photo.AlbumId
 order by NEWID()

This is return one record random

I want convert it to Linq to sql. I tried but not success.

Answer*

Cancel