|
楼主 |
发表于 2012-2-15 23:52
|
显示全部楼层
三坛老窖 发表于 2012-2-15 06:55
先在数据库中建一个查询视图,这样SQL写起来就容易。格式自己琢磨着去整理。
--------------------------- ...
老大,可不可以不用查询表而直接用SQL查询?我的数据在不断加入数据到BOM和IVN。
也就是将查询表的SQL合并到一个SQL中?
查询的SQL1= "SELECT BOM.ParentPN, BOM.ComponentPN, BOM.ComponentDescription, BOM.[Loss%], BOM.QtyPer, Inventory.BinLocation, Inventory.Qty, Inventory.Lastreceiving, Inventory.Lastissue, Inventory.Remark FROM BOM LEFT JOIN Inventory ON BOM.ComponentPN = Inventory.MaterialPN"
到查询表查数据的SQL2= "select ComponentPN, ComponentDescription, [Loss%], QtyPer, BinLocation, Qty from " & SQL1& " where ParentPN='" & Range("B1") & "' order by ComponentPN"
为何这样出错呢? |
|