假设有三个表:a,b,c,他们有相同的字段:ordernumber
select c.ordernumber,count,c.customer,from (SELECT ordernumber,count form a union select ordernumber,count from b),c where c.ordernumber=???.ordernumber
我把a表b表作一个union后得到的集合再与c表中ordernumber相同的数组成一个集合
问题是:组成union后的这个集合的ordernumber算那个表的?
也就是我的where不好判断?
也就是上面我打问号的?
select c.ordernumber,count,c.customer,from (SELECT ordernumber,count form a union select ordernumber,count from b),c where c.ordernumber=???.ordernumber
我把a表b表作一个union后得到的集合再与c表中ordernumber相同的数组成一个集合
问题是:组成union后的这个集合的ordernumber算那个表的?
也就是我的where不好判断?
也就是上面我打问号的?
解决方案 »
- 如果使用FGIntRSA加密数据???
- 用Delphi调用按键精灵的COM组件问题
- MDI窗体继承时的问题
- 三层服务器端的远程数据模块里面的ADOConnection可以像在数据模块里面一样,在程序里面进行操作吗?
- 如何用Query向表单中输入或者更改数据!!!
- 这个对高手不难,可我问了半天没人回答
- 优秀请进
- 请问:Delphi dbExpress 不能访问Oracle数据库表TimeStamp字段的解决办法
- 数据类型问题:VB调用Delphi的DLL
- 如何检测打印机的状态?急!!!
- 求助,一个TreeView的问题.....
- 我是一名大四学生,学了1年多的DELPHI,熟悉SQL SERVER 2000。
加 as 你命名的表名
select c.ordernumber,count,c.customer,from (SELECT ordernumber,count form a union select ordernumber,count from b) X,c where c.ordernumber=X.ordernumber
Union以后应该是一个新的表,所以既不是a表的也不是b表的,而是这个新表自己的,hiflower(花)正解.
from (SELECT ordernumber,count form a union select ordernumber,count from b) X,c where c.ordernumber=X.ordernumber
为什么这里不用as?