SELECT MOCTF.TF011,CMSMD.MD002,MOCTF.TF001,MOCTF.TF003,MOCTF.TF002,MOCTG.TG003,MOCTG.TG004,MOCTG.TG005,MOCTG.TG006,INVMB.MB006,INVMA.MA003,MOCTG.TG013,MOCTG.TG007,INVMB.MB053,INVMB.MB057
FROM way2006..MOCTF,way2006..MOCTG,way2006..INVMB,way2006..INVMA,way2006..CMSMD
WHERE   MOCTF.TF003>='20080201'
AND        MOCTF.TF003<='20080229'
AND        MOCTF.TF001=MOCTG.TG001
AND        MOCTF.TF002=MOCTG.TG002
AND        MOCTF.TF011=CMSMD.MD001
AND       MOCTG.TG004=INVMB.MB001
AND      INVMA.MA001='2'
AND      INVMB.MB006=INVMA.MA002 运行错误
服务器: 消息 107,级别 16,状态 2,行 1
The column prefix 'MOCTF' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'CMSMD' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'MOCTF' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'MOCTF' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'MOCTF' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'MOCTG' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'MOCTG' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'MOCTG' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'MOCTG' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'INVMB' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'INVMA' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'MOCTG' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'MOCTG' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'INVMB' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'INVMB' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'MOCTF' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'MOCTF' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'MOCTF' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'MOCTG' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 2,行 1
The column prefix 'MOCTF' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'MOCTG' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'MOCTF' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'CMSMD' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'MOCTG' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'INVMB' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'INVMA' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'INVMB' does not match with a table name or alias name used in the query.
服务器: 消息 107,级别 16,状态 1,行 1
The column prefix 'INVMA' does not match with a table name or alias name used in the query.
请教我要如何表达 查询这些值

解决方案 »

  1.   


    --try:
    SELECT a.TF011,e.MD002,a.TF001,a.TF003,a.TF002,b.TG003,b.TG004,b.TG005,b.TG006,c.MB006,d.MA003,b.TG013,b.TG007,
    c.MB053,c.MB057 
    FROM way2006..MOCTF a,way2006..MOCTG b,way2006..INVMB c,way2006..INVMA d,way2006..CMSMD e 
    WHERE   a.TF003>='20080201' 
    AND        a.TF003 <='20080229' 
    AND        a.TF001=b.TG001 
    AND        a.TF002=b.TG002 
    AND        a.TF011=e.MD001 
    AND       b.TG004=c.MB001 
    AND      d.MA001='2' 
    AND      c.MB006=d.MA002  
      

  2.   

    SELECT MOCTF.TF011,CMSMD.MD002,MOCTF.TF001,MOCTF.TF003,MOCTF.TF002,MOCTG.TG003,MOCTG.TG004,MOCTG.TG005,MOCTG.TG006,INVMB.MB006,INVMA.MA003,MOCTG.TG013,MOCTG.TG007,INVMB.MB053,INVMB.MB057 
    FROM way2006..MOCTF,way2006..MOCTG,way2006..INVMB,way2006..INVMA,way2006..CMSMD 
    -----from后面有相同的表名称,需要用别名区别开WHERE   MOCTF.TF003>='20080201' 
    AND        MOCTF.TF003 <='20080229' 
    AND        MOCTF.TF001=MOCTG.TG001 
    AND        MOCTF.TF002=MOCTG.TG002 
    AND        MOCTF.TF011=CMSMD.MD001 
    AND       MOCTG.TG004=INVMB.MB001 
    AND      INVMA.MA001='2' 
    AND      INVMB.MB006=INVMA.MA002  -----
    FROM way2006..MOCTF a,way2006..MOCTG b,way2006..INVMB c,way2006..INVMA d,way2006..CMSMD e
    字段名称前的表名也都用别名替换