⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ac2k1703.htm

📁 我是在使用VC查询数据库时
💻 HTM
字号:
<html>
<head>
<title>洪恩在线 - Access 2000</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="/pc/pc.css">
<link rel="stylesheet" href="/pc/pc.css">
<meta name="keywords" content="电脑,教育,教程,办公软件,microsoft,Office,office,Access,Access 2000,数据库">
</head>

<body bgcolor="white" text="black" topmargin="10" leftmargin="0" marginwidth="0" marginheight="10">
<!--顶部开始--> 
<script language="Javascript" src="/pub/js/head.js"></script>
<!--顶部结束--> 
<table width="760" height="20" border=0 cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td height=20 class="p1" bgcolor="#E8E8E8" align="left"><img src="/pc/img/blank.gif" width="12" height="8"><font color="#000000"><font color="#FF9966">当前位置</font>:<a href="http://www.book52.com/">LR电脑书籍网 </a> → <a href="http://www.book52.com/soft/">电脑书下载 </a> → <a href="http://www.book52.com/soft/sort06/list6_1.html">数据库类 </a> → <a href="http://www.book52.com/soft/sort06/sort049/list49_1.html">Access书籍 </a>  <font color="#330099">→</font> Access 2000</font></td>
  </tr>
</table>
<table width="760" border=0 cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td height="15"></td>
  </tr>
</table>
<table width="760" cellspacing="0" border=0 cellpadding="0" align="center">
  <tr> 
    <td width="145" valign="top" bgcolor="#E8E8E8" align="left" style="color:blue" class="p1" height="123"> 
     <br>
      <table width="145" border="0" cellspacing="0" cellpadding="0" bordercolor="#F8AC0E" align="center" height="20">
        <tr bgcolor="000099" valign="middle"> 
          <td width="109" align="center" class="p2"><font color="#FFFFFF"><b>Access 
            2000</b></font><font color="#FF3333" ><b></b></font></td>
          <td height="20" bgcolor="#E8E8E8" width="13"><img src="/pc/img/title_00.gif" width="13" height="20"></td>
          <td height="20" bgcolor="#E8E8E8" width="23">&nbsp;</td>
        </tr>
      </table>
      <p class="p1" style="line-height:17pt" align="left"> <span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12"> 
        <a href="ac2k0101.htm">初识Access 2000<br>
        </a></font><font color="#0000CC"> </font></span><span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12"> 
        <a href="ac2k0201.htm">窗口接口使用简介<br>
        </a></font></span><font color="#0000CC"><span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font> 
        <a href="ac2k0301.htm">用向导建立数据库</a></span></font><font color="#0000CC"><span class="p1"><a href="ac2k0301.htm"> 
        <br>
        </a><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font> 
        <a href="ac2k0401.htm">数据库的结构</a> <span class="p1"><a href="ac2k0403.htm"> 
        </a></span> <br>
        <font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font> 
        <a href="ac2k0501.htm">用表向导建立表</a></span></font> <font color="#0000CC"><span class="p1"><a href="ac2k0501.htm"> 
        <br>
        </a><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font> 
        <a href="ac2k0601.htm">在表中输入数据</a> <a href="ac2k0601.htm"><br>
        </a><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font> 
        <a href="ac2k0701.htm">数据的类型和属性</a><span class="p1"> </span><br>
        </span></font><span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font> 
        <a href="ac2k0801.htm">定义表之间的关系</a></span><span class="p1"><br>
        <font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font> 
        <a href="ac2k0901.htm">建立简单的查询</a></span><span class="p1"> <br>
        <font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font> 
        <a href="ac2k1001.htm">为查询制定规则</a><br>
        <font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font> 
        <a href="ac2k1101.htm">如何建立数据窗体<br>
        </a><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font> 
        <a href="ac2k1201.htm">生成数据打印报表</a></span><span class="p1"><br>
        <font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font> 
        <a href="ac2k1301.htm">为WEB页提供数据</a></span><span class="p1"> <br>
        <font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font></span> 
        <span class="p1"><a href="ac2k1401.htm">用图表显示数据</a></span> <br>
        <span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font></span> 
        <span class="p1"><a href="ac2k1501.htm">宏的使用</a></span> <br>
        <span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font></span> 
        <span class="p1"><a href="ac2k1601.htm">模块与“VBA”语言</a></span><a href="ac2k1601.htm"><span class="p1"> 
        </span></a><br>
        <span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font></span> 
        <span class="p1">SQL语言妙用</span></p>
      <p style="line-height:17pt" align="left">   <a href="ac2k1701.htm">查询中SQL视图的切换</a><br>
          <a href="ac2k1702.htm">基本的SQL语句</a><br>
          使用SQL语句联接表<br>
          <a href="ac2k1704.htm">补充内容</a><br>
        <br>
        <span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font></span> 
        <a href="ac2k1801.htm"><span class="p1">外部数据的使用</span><br>
        </a><span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font></span> 
        <a href="ac2k1901.htm"><span class="p1">数据的优化和安全</span><br>
        </a><span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font></span> 
        <a href="ac2k2001.htm"><span class="p1">容易忽略的工作</span></a></p>
      <p style="line-height:17pt" align="left">&nbsp;</p>
      <p align="center" class=p1><a href=/pc/bin/msg.pl?file_id=k_ac2k_17 target="_blank"><img src="/pc/img/message.gif" width="64" height="54" alt="请您留言" border="0"><br>
        谈谈您的看法</a> <br>
        <script language="javascript">
speak_num="za"
</script>
        <script language="javascript" src=/pc/var/pc_k_ac2k_17.js>
</script>
        <script language="javascript">
var num=0
if (!isNaN(speak_num)){
	num=speak_num;
}
else{
	num=0
}
document.writeln ("已有")
document.writeln (num)
document.writeln ("条发言")
</script>
      </p>
      <p class="p1" style="line-height:17pt" align="left">&nbsp; </p>
      <p class="p1" style="line-height:17pt" align="left">&nbsp; </p>
      </td>
    <td width=1 bgcolor=#0586D7 height="123"><img src="/pc/img/blank.gif" width="1" height="1"> 
    </td><td width=15 background="/pc/img/line.gif"><p>&nbsp;</p></td>
    <td valign="top" background="/pc/img/line.gif" width="584" height="123" class="p2"> 
      <p align="center"><font color="#ff333"><b><span class="p3"><br>
        </span><span class="p3"> 使用SQL语句联接表</span></b></font></p>
      <p align="left"><span style="line-height:17pt">  </span><span style="line-height:17pt">在SQL中,很多威力都来自于将几个表或查询中的信息联接起来,并将结果显示为单个逻辑记录集的能力。在这种联接中包括INNER、LEFT、RIGHT这三种JOIN操作。<br>
          首先我们来讲讲INNER JOIN 的用法:INNER JOIN 语句可以用来组合两个表中的记录,只要在公共字段之中有相符的值即可,在语法上,INNER 
        JOIN 是这样定义的。</span> </p>
      <p align="center"><img src="img/ac2k1721.gif" width="450" height="169" alt="INNER JOINd的定义方式" border="1"></p>
      <p><span style="line-height:17pt">  举个例子:我们现在要将“图书资料表”和“出版社资料表”联接起来,然后列出出版社所出的图书。让我们先看看这两个表,</span></p>
      <p align="center"><img src="img/ac2k1723.gif" width="395" height="113" alt="出版社资料表" border="1"><br>
        <br>
        <img src="img/ac2k1722.gif" width="400" height="249" alt="图书资料表" border="1"> 
      </p>
      <p><span style="line-height:17pt">  然后在SQL设计视图中输入以下内容</span></p>
      <p align="center"><img src="img/ac2k1724.gif" width="256" height="74" alt="输入的内容" border="1"></p>
      <p><span style="line-height:17pt">   现在我们执行这个SQL语句,</span></p>
      <p align="center"><img src="img/ac2k1725.gif" width="208" height="239" alt="执行结果" border="1"></p>
      <p><span style="line-height:17pt">  发现现在的查询结果将所有出版社和图书都列了出来。<br>
          这个查询好像也可以用下面的语句来实现。</span></p>
      <p align="center"><img src="img/ac2k1726.gif" width="258" height="84" alt="另一种语句" border="1"></p>
      <p><span style="line-height:17pt">   将两个查询都切换到数据表视图后我们会发现两个查询的查询结果虽然一样,但<b>在使用INNER 
        JOIN操作的查询中可以添加新的数据。</b>就像在表中添加数据一样。而没有使用INNER JOIN 操作的查询就不能添加新数据,相比之下使用INNER 
        JOIN操作的查询更像将两个具有相关内容的表联接在一起新生成的表。 <br>
          知道了它的用处,我们来看看LEFT JOIN 的结构: <br>
        <font color="#3333FF">FROM [表名1] LEFT JOIN [表名2] <br>
        ON [表名1.字段A] 〈关系运算符〉[表名2.字段B]</font><br>
          其实LEFT JOIN 的功能就是将LEFT左边的表名1中的所有记录全部保留,而将右边的表名2中的字段B与表名1.字段A相对应的记录显示出来。而RIGHT 
        JOIN 和LEFT JOIN 相反。<br>
          所以刚才的那个例子还可以写成:</span></p>
      <p align="center"><img src="img/ac2k1727.gif" width="249" height="80" alt="刚才那个例子程序的另一种写法" border="1"></p>
      <p><span style="line-height:17pt">   单击工具栏上的“执行”按钮,我们看到这时显示的数据表和刚才显示的用LEFT 
        JOIN 的数据表一样。现在看出来了吧,原来它们的功能是可以互换的。 <br>
        <br>
          如果想将几个表联接起来,在JOIN操作中我们可以进行嵌套操作,有三个表:表1、表2、表3,现在将三个表联接起来: <br>
        <font color="#3333FF">FROM (表1 INNER JOIN 表2 ON 表1.序号=表2.序号)<br>
        INNER JOIN 表3 <br>
        ON 表1.序号=表3.序号</font> <br>
          这样这三个表就联接起来了。 <br>
          </span><span style="line-height:17pt"> </span> </p>
      <p align="center"><a href="ac2k1702.htm"><font size="2">上一节</font></a><font size="2"> 
          <a href="ac2k1704.htm">下一节</a></font>&nbsp;&nbsp;&nbsp;</p>
      <p align="center"><a href=/pc/bin/msg.pl?file_id=k_ac2k_17 target="_blank"><img src="/pc/img/message.gif" width="64" height="54" alt="请您留言" border="0"><br>
        谈谈您的看法</a> 
        <script language="javascript">
speak_num="za"
</script>
        <script language="javascript" src=/pc/var/pc_k_ac2k_17.js>
</script>
        <script language="javascript">
var num=0
if (!isNaN(speak_num)){
	num=speak_num;
}
else{
	num=0
}
document.writeln ("已有")
document.writeln (num)
document.writeln ("条发言")
</script>
      </p>
      <p>&nbsp;</p></td><td width=15 background="/pc/img/line.gif"><p>&nbsp;</p></td>
  </tr>
</table>
<!--底部开始--> 
<script language="Javascript" src="/pub/js/foot.js"></script>
<!--底部结束-->
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -