Monday, 15 March 2010

c# - LINQ to SQL query not ordering properly, please help -


  var assetVisit.AssetID joining assetBundle in db.AssetBundles from assetVisit temp = (db.AssetVisits assetBundle equals the K Assetid join groupBundle in db.GroupBundles on assetBundle.BundleID is equal to join usergroup in db.UserGroups on groupBundle.BundleID groupBundle.GroupID userGroup.GroupID where assetVisit.CompanyID == companyID & amp; & amp; userGroup.UserID == userID new selection {assetid = AssetVisit.AssetID, Count = assetVisit.AccessCounter}). Specific (); IQueryable & LT; Assets & gt; Last = (temporarily include assets db.Assets on t.AssetID t equals asset.AssetID where asset.IsActive == true & amp; & amp; asset.AssetTypeID == assetType & amp; & amp; asset.ShowInResults == true & amp; & amp; (asset.CompanyID == companyID || asset.CompanyID == - + 12081 9 74) orderby t.Count select property descending) .Except (companyAssets db in db.Assets in .Assets on joining copiedAssets equals companyAssets.AssetID copiedAssets.OriginalAssetID where copiedAssets.CompanyID == companyID & amp; & amp; companyAssets.CompanyID == -12081974 & amp; & amp; copiedAssets.IsActive == True selection companyAssets); Return final Take (border);  

OK, it looks like the property is back T. Seems to be given on the basis of, but I think that it probably is not working. Because the amount is not actually part of the property that is getting selected, but I do not know how to fix it.

You can see there is an assetVisits table and a property table, and I can not get the propertyVisits.AccessCount but I need to get the property back in order to make it work, Hell? ?

You asked a few hours ago, and the answer is the same: after that You have selected the rows you want to order.

Change:

  return final .Take (limit); For  

:

  var get the last retirement = from the property to join the asset. Property in Db AssetVisits on Property Select assetVisit.AccessCounter property from assetVisit.AssetID order equal to AssetID; Return final order. Take (border);  

You can also remove premature 'orderbay' from your own code, because it is not doing anything.


No comments:

Post a Comment