select DATE,prd_no,qty into #temp from t1
union 
select DATE,prd_no,qty from t2
union 
select DATE,prd_no,qty from t3
然后直接对#temp进行条件筛选。

解决方案 »

  1.   

    select DATE,prd_no,qty from t1
    union 
    select DATE,prd_no,qty from t2
    union 
    select DATE,prd_no,qty from t3as t
    对t直接进行条件选择
      

  2.   

    我试试上面的方法!
    SQL有没有象程序中那样的循环语句?
    就象下面
    for i=1 to 10
      for j=1 to 10
        ...
      next j
    next i
    要想实现这样的功能该怎么做写?
      

  3.   

    新表的字段是date,prd_no,qty1,qty2,qty3
    而用
    select DATE,prd_no,qty from t1
    union 
    select DATE,prd_no,qty from t2
    union 
    select DATE,prd_no,qty from t3
    生成的表的字段是date,prd_no,qty不一样!?