<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : OrderBy on subquery</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce Classic : OrderBy on subquery</description>
  <pubDate>Fri, 12 Jun 2026 00:10:54 -700</pubDate>
  <lastBuildDate>Sun, 29 Jul 2007 17:55:54 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=323</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>OrderBy on subquery : Paul   I need to add the data...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=323&amp;PID=794#794</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=42" rel="nofollow">Markh</a><br /><strong>Subject:</strong> 323<br /><strong>Posted:</strong> 29-Jul-2007 at 5:55pm<br /><br /><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">Paul <?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">&nbsp;<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">I need to add the data to a tree view and order the data within the nodes to be&nbsp;based on Names not IDs.<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">&nbsp;<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">The applySort only allow you to sort by one column. I need to sort by 4 different levels<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">Level1<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Level2<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Level3<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Level4<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">&nbsp;<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">FYI<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">I changed the query and got O</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">rder By Inconsistency <o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">1.The following code returns order by data for each entity correctly only the first time.<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Entity1 ordered by Descending<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Entity2 ordered by Descending<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Entity3 ordered by Descending<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Entity4 ordered by Descending<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">query.AddOrderBy(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">Level1</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Level1NameEntityColumn,</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ListSortDirection</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Descending);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">EntitySubquery</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> subQueryLevel2 = query.AddSubquery(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">EntityRelations</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Level1_Level2);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">subQueryLevel2.AddOrderBy(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">Level2</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.LocationNameEntityColumn, </SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ListSortDirection</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Descending);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">EntitySubquery</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> subQueryLevel3 = subQueryLevel2.AddSubquery(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">EntityRelations</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Level2_Level3);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">subQueryLevel3.AddOrderBy(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">Level3</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.WorkSiteDescEntityColumn, </SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ListSortDirection</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Descending);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">EntitySubquery</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> subQueryLevel4 = subQueryLevel3.AddSubquery(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">EntityRelations</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Level3_CostCentre);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">subCostCentre.AddOrderBy(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CostCentre</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.CostCentreDescriptionEntityColumn,</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ListSortDirection</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Descending);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">2. When I change the code (as follows) to make Entity1 Ascending. The returned data is correct<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Entity1 ordered by Ascending<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Entity2 ordered by Descending<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Entity3 ordered by Descending<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Entity4 ordered by Descending<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">query.AddOrderBy(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">Level1</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Level1NameEntityColumn,</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ListSortDirection</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Ascending);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">EntitySubquery</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> subQueryLevel2 = query.AddSubquery(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">EntityRelations</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Level1_Level2);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">subQueryLevel2.AddOrderBy(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">Level2</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.LocationNameEntityColumn, </SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ListSortDirection</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Descending);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">EntitySubquery</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> subQueryLevel3 = subQueryLevel2.AddSubquery(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">EntityRelations</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Level2_Level3);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">subQueryLevel3.AddOrderBy(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">Level3</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.WorkSiteDescEntityColumn, </SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ListSortDirection</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Descending);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">EntitySubquery</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> subQueryLevel4 = subQueryLevel3.AddSubquery(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">EntityRelations</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Level3_CostCentre);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">subCostCentre.AddOrderBy(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CostCentre</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.CostCentreDescriptionEntityColumn,</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ListSortDirection</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Descending);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">3. When I change the code (as follows) to make Entity2 Ascending. The returned data is incorrect<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Entity1 ordered by Ascending<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Entity2 ordered by Descending<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Entity3 ordered by Descending<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Entity4 ordered by Descending<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">query.AddOrderBy(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">Level1</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Level1NameEntityColumn,</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ListSortDirection</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Ascending);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">EntitySubquery</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> subQueryLevel2 = query.AddSubquery(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">EntityRelations</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Level1_Level2);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">subQueryLevel2.AddOrderBy(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">Level2</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.LocationNameEntityColumn, </SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ListSortDirection</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Ascending);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">EntitySubquery</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> subQueryLevel3 = subQueryLevel2.AddSubquery(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">EntityRelations</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Level2_Level3);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">subQueryLevel3.AddOrderBy(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">Level3</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.WorkSiteDescEntityColumn, </SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ListSortDirection</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Descending);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">EntitySubquery</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"> subQueryLevel4 = subQueryLevel3.AddSubquery(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">EntityRelations</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Level3_CostCentre);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P style="MARGIN: 0cm 0cm 0pt; mso-layout-grid-align: '='Ms&#111;normal"><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">subCostCentre.AddOrderBy(</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">CostCentre</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.CostCentreDescriptionEntityColumn,</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">ListSortDirection</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'; mso-no-proof: yes">.Descending);<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">By creating a new persistence manager each time the query is executed the code above works correctly.<o:p></o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Only the Entity1 “OrderBy” works correctly each time the sort direction is changed. (ie without creating a new persistence manager or removing entities)<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><o:p></o:p><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana"><o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">By adding the "subquery.Top = 100" to all subquerys fixed the problem.<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">&nbsp;<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">Using Top = 100 means using an arbitrary number for the number of records to return.<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">&nbsp;<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">In SQL you use the "Top 100 percent" to return all associated records.<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">&nbsp;<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">&nbsp;<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">I know I can all retrieve Level1s apply a ApplySort()&nbsp;then interate through them all, get all&nbsp;Level2s attached to the&nbsp;first Level1, ApplySort to Level2s etc.....<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">&nbsp;<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">Is this the way you recommend ?<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">&nbsp;<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">&nbsp;<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">&nbsp;<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">Thanks<o:p></o:p></SPAN></P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Sun, 29 Jul 2007 17:55:54 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=323&amp;PID=794#794</guid>
  </item> 
  <item>
   <title>OrderBy on subquery : It&amp;#039;s not clear to me what...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=323&amp;PID=752#752</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=43" rel="nofollow">pkarsh</a><br /><strong>Subject:</strong> 323<br /><strong>Posted:</strong> 24-Jul-2007 at 3:48pm<br /><br />It's not clear to me what you want to accomplish by adding AddOrderBy clauses to your subqueries.  I did find, though, that the "AddOrderBy" clause of a subquery is ignored when the raw SQL is generated from the OQL unless the TOP property of the subquery is set.<br /><br />You can see the SQL that gets generated by your OQL code by looking in the DebugLog, which is in the same directory as the startup executable.<br /><br />The following code:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EntityQuery orderSummaryQuery = new EntityQuery(typeof(OrderSummary));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EntitySubquery aShipperSubQuery = orderSummaryQuery.AddSubquery(EntityRelations.Shipper_OrderSummary);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//aShipperSubQuery.Top = 4;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;aShipperSubQuery.AddOrderBy(Shipper.CompanyNameEntityColumn);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EntitySubquery aCustomerSubQuery = orderSummaryQuery.AddSubquery(EntityRelations.Customer_OrderSummary);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//aCustomerSubQuery.Top = 100;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;aCustomerSubQuery.AddOrderBy(Customer.CompanyNameEntityColumn);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;orders = mPm.GetEntities&lt;OrderSummary&gt;(orderSummaryQuery);<br /><br />yields the following raw SQL:<br />select * from "dbo"."OrderSummary" where ((Id &lt; 10290) and (("dbo"."OrderSummary"."CustomerId" in (select "dbo"."Customer"."Id" from "dbo"."Customer") and "dbo"."OrderSummary"."ShipperId" in (select "dbo"."Shipper"."Id" from "dbo"."Shipper"))))<br /><br />If I uncomment the statements in the code above such that each subquery has the value set for the "Top" property, the SQL generated looks like this:<br /><br />select * from "dbo"."OrderSummary" where ((Id &lt; 10290) and (("dbo"."OrderSummary"."CustomerId" in (select TOP 100 "Id" from "dbo"."Customer" ORDER BY "dbo"."Customer"."CompanyName" ASC) and "dbo"."OrderSummary"."ShipperId" in (select TOP 4 "Id" from "dbo"."Shipper" ORDER BY "dbo"."Shipper"."CompanyName" ASC))))<br /><br />Notice that the Subquerys now contain ORDERBY clauses.<br /><br />FWIW, SQL itself has the same restriction.  If you try to add OrderBy clauses to subqueries without specifying TOP values you will get an error.<br /><br />In my testing I did not see that the AddOrderBy clauses affected the display of the results.  I did notice that adding "ApplySort" method calls to the EntityList did sort the results by the contents of the specified Relational Property column.  For example, the code:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;orders.ApplySort("Customer.CompanyName", ListSortDirection.Ascending, true);<br /><br />did cause the Orders to be sorted by the Customer CompanyName property.<br /><br /><br />]]>
   </description>
   <pubDate>Tue, 24 Jul 2007 15:48:50 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=323&amp;PID=752#752</guid>
  </item> 
  <item>
   <title>OrderBy on subquery : How do you orderby on a subquery?...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=323&amp;PID=746#746</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=42" rel="nofollow">Markh</a><br /><strong>Subject:</strong> 323<br /><strong>Posted:</strong> 23-Jul-2007 at 12:15am<br /><br />How do you orderby on a subquery? <DIV>&nbsp;</DIV><DIV>I am trying to do multiple "order by"s &nbsp;of properties(column) within&nbsp;related Entities.</DIV><DIV>ie&nbsp;</DIV><DIV>first order Entity1 by a <SPAN lang=EN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-ansi-: EN">property(Column) </SPAN><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN>in Entity2 </DIV><DIV>second order Entity1 by a&nbsp; <SPAN lang=EN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-ansi-: EN">property(Column) </SPAN>in Entity3</DIV><DIV>third order Entity1 by a&nbsp; <SPAN lang=EN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-ansi-: EN">property(Column) </SPAN>in Entity4</DIV><DIV>&nbsp;</DIV><DIV>I can do this by using ICompare in Entity1, Is there another way?&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>I thought that a subquery "orderby" would order the query entity (as in SQL where you can order by joined table), but</DIV><DIV>I assume that a subquery "orderby" orders the Entity attached by the relation. Is this Correct ?</DIV><DIV>&nbsp;</DIV><DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV><span style="font-size:10px"><br /><br />Edited by Markh - 23-Jul-2007 at 5:15pm</span>]]>
   </description>
   <pubDate>Mon, 23 Jul 2007 00:15:05 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=323&amp;PID=746#746</guid>
  </item> 
 </channel>
</rss>