|
SELECT 物料_申请表.申请ID as ID, 物料_申请表.申请日期 as 日期, 物料_代码表.物料代码, 物料_代码表.物料名称, 物料_代码表.物料规格, 物料_代码表.类别, a as 仓位,a as 单位名称, a as 模号, 0 as 安全库存, 物料_申请表.申请数, 0 as 进料数, 0 as 领料数, 0 as 退料数
FROM 物料_代码表 INNER JOIN 物料_申请表 ON 物料_代码表.物料ID = 物料_申请表.物料ID
union select all 物料_进料表.进料ID as ID, 物料_进料表.进料日期 as 日期, 物料_代码表.物料代码, 物料_代码表.物料名称, 物料_代码表.物料规格, 物料_代码表.类别, 物料_进料表.仓位 as 仓位, a as 单位名称, a as 模号, 0 as 安全库存, 0 as 申请数,物料_进料表.进料数, 0 as 领料数, 0 as 退料数
FROM 物料_代码表 INNER JOIN 物料_进料表 ON 物料_代码表.物料ID = 物料_进料表.物料ID
union select all 物料_领料表.领料ID as ID, 物料_领料表.领料日期 as 日期, 物料_代码表.物料代码, 物料_代码表.物料名称, 物料_代码表.物料规格, 物料_代码表.类别, a as 仓位, 物料_领料表.单位名称 as 单位名称, 物料_领料表.模号 as 模号, 0 as 安全库存, 0 as 申请数, 0 as 进料数, 物料_领料表.领料数, 0 as 退料数
FROM 物料_代码表 INNER JOIN 物料_领料表 ON 物料_代码表.物料ID = 物料_领料表.物料ID
UNION select all 物料_退料表.ID as ID, 物料_退料表.退料日期 as 日期, 物料_代码表.物料代码, 物料_代码表.物料名称, 物料_代码表.物料规格, 物料_代码表.类别,a as 仓位,a as 单位名称, 物料_退料表.模号 as 模号, 0 as 安全库存, 0 as 申请数, 0 as 进料数, 0 as 领料数,物料_退料表.退料数
FROM 物料_代码表 INNER JOIN 物料_退料表 ON 物料_代码表.物料ID = 物料_退料表.物料ID;
多表联合查询时,增加文本字段时用“a”代替,查询时显示需要“a”的参数;如何写查询!请高手帮助菜了!谢谢 |
|