none
How can i convert this sql query to entity framework version 4.0 RRS feed

  • Question

  • select 
    `smartistdetails`.`ArtistID` AS `ArtistID`,
    `smartistdetails`.`BandName` AS `BandName`,
    `smartistdetails`.`SongsRegistered` AS `SongsRegistered`,
    `smartistdetails`.`GigsRegistered` AS `GigsRegistered`,
    `smartistdetails`.`EmailAddress` AS `EmailAddress`,
    count(`smdistributionfiledetail`.`DistFileDetId`) AS `ArtistRoyaltyCounts`,
    `smdistributionfile`.`DistFileId` AS `DistFileId`,
    `smartistdetails`.`RegistrationDate` AS `RegistrationDate`,
    `smartistdetails`.`LastLoggedInDate` AS `LastLoggedInDate`,
    `smartistdetails`.`LastTimeGigRegistered` AS `LastTimeGigRegistered`,

    (
    select `smdistributionstatements`.`PaymentCompletionDate` from `smdistributionstatements` 
    where (
    (`smdistributionstatements`.`fkArtistId` = `smartistdetails`.`ArtistID`) 
    and 
    (`smdistributionstatements`.`fkStatusId` = 5)

    order by `smdistributionstatements`.`PaymentCompletionDate` desc limit 1
    ) AS `LastPaymentDate`,

    (
    select `smdistributionstatements_2`.`TotalNetRoyalty` 
    from `smdistributionstatements` `smdistributionstatements_2` 
    where (
    (`smdistributionstatements_2`.`fkArtistId` = `smartistdetails`.`ArtistID`) 
    and 
    (`smdistributionstatements_2`.`fkStatusId` = 5)

    order by `smdistributionstatements_2`.`PaymentCompletionDate` desc limit 1
    ) AS `LastPaymentAmount` 

    from
    (
    (
    (`smartistdetails` join `smtracks` 
    on (
    (`smartistdetails`.`ArtistID` = `smtracks`.`fkArtistID`)
    )
    ) join `smdistributionfiledetail` 
    on (
    (`smtracks`.`TracksID` = `smdistributionfiledetail`.`fkTracksId`)
    )
    ) join `smdistributionfile` 
    on (
    (`smdistributionfiledetail`.`fkDistFileId` = `smdistributionfile`.`DistFileId`)
    )
    ) group by 

    `smartistdetails`.`ArtistID`,
    `smartistdetails`.`BandName`,
    `smartistdetails`.`SongsRegistered`,
    `smartistdetails`.`GigsRegistered`,
    `smartistdetails`.`EmailAddress`,`smdistributionfile`.`DistFileId`,
    `smartistdetails`.`RegistrationDate`,
    `smartistdetails`.`LastLoggedInDate`,
    `smartistdetails`.`LastTimeGigRegistered`
    Monday, November 19, 2012 4:47 PM

Answers