
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
	<head><meta forua="true" http-equiv="Cache-Control" content="max-age=0" /></head><card id="MainCard" title="&#x6B22;&#x8FCE;&#x5149;&#x4E34;"><p><a href="wap.asp">&#x6728;&#x5B50;&#x5C4B;</a><br/>&nbsp;</p><p><b>&#x6807;&#x9898;&#x3A;</b> &#x4C;&#x69;&#x6E;&#x71;&#x591A;&#x8868;&#x4A;&#x6F;&#x69;&#x6E;&#x5B9E;&#x73B0;&#x53CA;&#x4F18;&#x5316;&#x28;&#x65B9;&#x6CD5;&#x8BED;&#x6CD5;&#x29;</p><p><b>&#x4F5C;&#x8005;&#x3A;</b> &#x64;&#x6E;&#x61;&#x77;&#x6F;</p><p><b>&#x65E5;&#x671F;&#x3A;</b> &#x32;&#x30;&#x31;&#x33;&#x2D;&#x30;&#x37;&#x2D;&#x31;&#x31;&#x20;&#x31;&#x30;&#x3A;&#x34;&#x34;&#x20;&#x41;&#x4D;</p><p><b>&#x5206;&#x7C7B;&#x3A;</b> <a href="wap.asp?do=showLog&amp;cateID=16">&#x57;&#x69;&#x6E;&#x7F16;&#x7A0B;</a></p><p><b>&#x5185;&#x5BB9;&#x3A;</b> &#x6709;&#x4E09;&#x5F20;&#x8868;&#x8981;&#x8FDB;&#x884C;inner join&#x67E5;&#x8BE2;&#xFF0C;&#x8868;&#x7ED3;&#x6784;&#x5982;&#x4E0B;&#xFF1A;<br/>&#x590D;&#x5236;&#x5185;&#x5BB9;&#x5230;&#x526A;&#x8D34;&#x677F; &#x7A0B;&#x5E8F;&#x4EE3;&#x7801;--TabA<br/>cr&#101;ate table TabA<br/>(<br/>&#160;&#160;&#160;&#160;Id int identity(1,1) primary key,<br/>&#160;&#160;&#160;&#160;Name nvarchar(20)<br/>)<br/>--TabB<br/>cr&#101;ate table TabB<br/>(<br/>&#160;&#160;&#160;&#160;Id int identity(1,1) primary key,<br/>&#160;&#160;&#160;&#160;Name nvarchar(20),<br/>&#160;&#160;&#160;&#160;Aid int references TabA(Id)<br/>)<br/>--TabC<br/>cr&#101;ate table TabC<br/>(<br/>&#160;&#160;&#160;&#160;Id int identity(1,1) primary key,<br/>&#160;&#160;&#160;&#160;Name nvarchar(20),<br/>&#160;&#160;&#160;&#160;Bid int references TabB(Id)<br/>)<br/>&#x53C2;&#x7167;&#x4E24;&#x8868;Join&#x8BED;&#x53E5;&#xFF0C;&#x4F7F;&#x7528;&#x65B9;&#x6CD5;&#x8BED;&#x6CD5;&#x53EF;&#x4EE5;&#x8FD9;&#x4E48;&#x5199;&#xFF1A;<br/>&#x590D;&#x5236;&#x5185;&#x5BB9;&#x5230;&#x526A;&#x8D34;&#x677F; &#x7A0B;&#x5E8F;&#x4EE3;&#x7801;var data = context.TabAs.Join(context.TabBs, taba =&gt; taba.Id, tabb =&gt; tabb.Aid, (taba, tabb) =&gt; new { AName = taba.Name, BName = tabb.Name, Bid = tabb.Id }).Join(context.TabCs, item =&gt; item.Bid, tabc =&gt; tabc.Bid, (item, tabc) =&gt; new { AName = item.AName, BName = item.BName, CName = tabc.Name });<br/>&#x8FD9;&#x6837;&#x867D;&#x53EF;&#x4EE5;&#x8FBE;&#x5230;&#x8981;&#x6C42;&#xFF0C;&#x4F46;&#x6BCF;Join&#x4E00;&#x5F20;&#x8868;&#xFF0C;new&#x4E2D;&#x5B57;&#x6BB5;&#x5C31;&#x5F97;&#x91CD;&#x590D;&#x5199;&#x4E00;&#x6B21;&#xFF0C;&#x82E5;&#x8FD4;&#x56DE;&#x5B57;&#x6BB5;&#x591A;&#xFF0C;&#x4E66;&#x5199;&#x9EBB;&#x70E6;&#xFF0C;&#x8BED;&#x53E5;&#x4E5F;&#x975E;&#x5E38;&#x957F;&#xFF0C;&#x7ECF;&#x8FC7;&#x6D4B;&#x8BD5;&#xFF0C;&#x6700;&#x7EC8;&#x4F18;&#x5316;&#x5982;&#x4E0B;&#xFF1A;<br/>&#x590D;&#x5236;&#x5185;&#x5BB9;&#x5230;&#x526A;&#x8D34;&#x677F; &#x7A0B;&#x5E8F;&#x4EE3;&#x7801;var data = context.TabAs.Join(context.TabBs, taba =&gt; taba.Id, tabb =&gt; tabb.Aid, (taba, tabb) =&gt; new { taba, tabb }).Join(context.TabCs, item =&gt; item.tabb.Id, tabc =&gt; tabc.Bid, (item, tabc) =&gt; new { AName = item.taba.Name, BName = item.tabb.Name, CName = tabc.Name });<br/>&#x5F53;&#x7136;&#x4E86;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x7528;Linq&#x67E5;&#x8BE2;&#x8BED;&#x6CD5;&#x6765;&#x5B9E;&#x73B0;&#xFF0C;&#x90A3;&#x5C31;&#x7B80;&#x5355;&#x591A;&#x4E86;&#xFF1A;<br/>&#x590D;&#x5236;&#x5185;&#x5BB9;&#x5230;&#x526A;&#x8D34;&#x677F; &#x7A0B;&#x5E8F;&#x4EE3;&#x7801;var data = from taba in context.TabAs<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;join tabb in context.TabBs on taba.Id equals tabb.Aid<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;join tabc in context.TabCs on tabb.Id equals tabc.Bid<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sel&#101;ct new { AName = taba.Name, BName = tabb.Name, CName = tabc.Name };</p><p> + <a href="#CommentCard">&#x67E5;&#x770B;&#x5F53;&#x524D;&#x65E5;&#x5FD7;&#x8BC4;&#x8BBA;</a> (0)</p><p>&nbsp;<br/><br/><a href="wap.asp?do=Login">&#x767B;&#x5F55;</a></p><p><br/>&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;</p><p><a href="wap.asp">&#x6728;&#x5B50;&#x5C4B;</a></p><p><a href="http://www.pjhome.net/wap.asp">PJBlog3&nbsp;v3.2.9.518</a>&nbsp;Inside.</p><p>Processed&nbsp;In&nbsp;0.031&nbsp;ms</p><do type="prev" label="&#x8FD4;&#x56DE;"><prev/></do></card><card id="postCommentCard"><p><b>&#x6807;&#x9898;&#x3A;</b> <a href="#MainCard">&#x4C;&#x69;&#x6E;&#x71;&#x591A;&#x8868;&#x4A;&#x6F;&#x69;&#x6E;&#x5B9E;&#x73B0;&#x53CA;&#x4F18;&#x5316;&#x28;&#x65B9;&#x6CD5;&#x8BED;&#x6CD5;&#x29;</a></p><p><br/>你没有权限发表评论</p><p><br/>&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;</p><p><a href="wap.asp">&#x6728;&#x5B50;&#x5C4B;</a></p><p><a href="http://www.pjhome.net/wap.asp">PJBlog3&nbsp;v3.2.9.518</a>&nbsp;Inside.</p><p>Processed&nbsp;In&nbsp;0.031&nbsp;ms</p><do type="prev" label="&#x8FD4;&#x56DE;"><prev/></do></card><card id="CommentCard"><p>&#x6682;&#x65E0;&#x8BC4;&#x8BBA;</p><p><a href="#MainCard">&#x8FD4;&#x56DE;</a></p><p><br/>&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;&#x2500;</p><p><a href="wap.asp">&#x6728;&#x5B50;&#x5C4B;</a></p><p><a href="http://www.pjhome.net/wap.asp">PJBlog3&nbsp;v3.2.9.518</a>&nbsp;Inside.</p><p>Processed&nbsp;In&nbsp;0.031&nbsp;ms</p><do type="prev" label="&#x8FD4;&#x56DE;"><prev/></do></card>
</wml>
