主表:Maintables
主表ID 日期 布尔型
BillID StockDate IsAvail子表:Storage
主表ID 代码 布尔型
BillID Code Exist
主表:Shipment
主表ID 日期 布尔型
ShipmentID ShipmentDate IsAvail子表:Shipment_Detail
主表ID 代码 布尔型
ShipmentID Code IsQuit
要求:用一个查询将Maintables和Shipment相同的时间段内的Code选择出来,且去除重复项,IsAvail、Exist、IsQuit为真
主表ID 日期 布尔型
BillID StockDate IsAvail子表:Storage
主表ID 代码 布尔型
BillID Code Exist
主表:Shipment
主表ID 日期 布尔型
ShipmentID ShipmentDate IsAvail子表:Shipment_Detail
主表ID 代码 布尔型
ShipmentID Code IsQuit
要求:用一个查询将Maintables和Shipment相同的时间段内的Code选择出来,且去除重复项,IsAvail、Exist、IsQuit为真
你最好先写个大概!
别人在你的基础上修改比较好1
from storage
where Maintables.StockDate=Shipment.ShipmentDate and Maintables.billid=Storage.billid and
union
select code
from Shipment_Detail
where Maintables.StockDate=Shipment.ShipmentDate and
Shipment.shipmentid=Shipment_Detail.shipmentid