hello,
I have this product query in SQL now i am coverting all my queries to LinQ, i have stuck in this query how it can be covert to LinQ
please advice
SQL -
SELECT DISTINCT
TOP (50) dbo.ads.id,cast(dbo.ads.heading as nvarchar(100)) as heading,
CASE WHEN dbo.ads.price = '0' THEN 'Byd' ELSE 'Pris: ' + dbo.ads.price END AS price, imags.path AS imagepath
FROM dbo.ads INNER JOIN
dbo.users ON dbo.ads.authorId = dbo.users.id INNER JOIN
(SELECT DISTINCT ads_1.id AS [ad id], dbo.adsimages.id_image AS imageid, dbo.images.id AS pathid, dbo.images.path, dbo.adsimages.id
FROM dbo.adsimages INNER JOIN
dbo.images ON dbo.adsimages.id_image = dbo.images.id INNER JOIN
dbo.ads AS ads_1 ON dbo.adsimages.id_ad = ads_1.id
WHERE (ads_1.id = ads_1.id) AND (dbo.adsimages.id =
(SELECT MAX(id) AS adsimagesid
FROM dbo.adsimages AS adsimages_1
WHERE (id_ad = ads_1.id)))) AS imags ON dbo.ads.id = imags.[ad id]
WHERE (dbo.ads.status = N'Active')
ORDER BY dbo.ads.id DESC