SQL Left Outer Join

Clarification:

You are missing the relationship of OrderRel.ShipToNum =
ShipHed.ShipToNum.

You are also missing a relationship relating ShipTo.Company and
ShipTo.CusNum to any other table.

Lynn


--- In vantage@yahoogroups.com, "Lynn" <lynn.khalife@...> wrote:
>
> Rich:
>
> You have a typo:
>
> OrderRel.ShipToNum = ShipTo.ShipToNum AND
>
> You refer to the ShipTo table instead of the ShipHead table.
>
> Lynn
>
>
> --- In vantage@yahoogroups.com, "RICH WAGNER" <rwagner@> wrote:
> >
> > Can anyone help me with creating a SQL statement for my VB
script.
> I need to left outer join the OrderRel and ShipHead table in the
> following statement.
> >
> > mySQLvan = "SELECT OrderHed.OrderNum, OrderHed.PONum,
> OrderRel.ShipToNum, OrderRel.ReqDate, OrderRel.NeedByDate,
> OrderRel.ShipViaCode, OrderRel.Character01, ShipTo.Address1,
> ShipTo.City, ShipTo.State, OrderDtl.XpartNum, OrderDtl.PartNum,
> OrderDtl.LineDesc, OrderRel.SellingReqQty,
> OrderRel.SellingJobShippedQty, OrderRel.SellingStockShippedQty FROM
> pub.Customer, pub.OrderHed, pub.OrderDtl, pub.OrderRel, pub.ShipTo,
> pub.ShipHead WHERE Customer.CustNum = OrderHed.CustNum AND
> Customer.Company = OrderHed.Company AND OrderHed.OrderNum =
> OrderDtl.OrderNum AND OrderHed.Company = OrderDtl.Company AND
> OrderDtl.Company = OrderRel.Company AND OrderDtl.OrderNum =
> OrderRel.OrderNum AND OrderDtl.OrderLine = OrderRel.OrderLine AND
> OrderRel.ShipToNum = ShipTo.ShipToNum AND OrderRel.Company =
> ShipHead.Company AND OrderRel.OrderNum = ShipHead.OrderNum AND
> Customer.Company = 'BTEST' AND Customer.CustNum = 6380 AND
> OrderHed.OpenOrder = 1 AND ShipTo.CustNum = 6380"
> >
> >
> > Thanks,
> >
> >
> >
> > Rich Wagner
> >
> >
> >
> > [cid:image002.jpg@]
> >
> >
> >
> >
> >
> > 412-384-3100
> >
> > rwagner@<mailto:rwagner@>
> >
> > www.bawplastics.com<http://www.bawplastics.com/>
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
Can anyone help me with creating a SQL statement for my VB script. I need to left outer join the OrderRel and ShipHead table in the following statement.

mySQLvan = "SELECT OrderHed.OrderNum, OrderHed.PONum, OrderRel.ShipToNum, OrderRel.ReqDate, OrderRel.NeedByDate, OrderRel.ShipViaCode, OrderRel.Character01, ShipTo.Address1, ShipTo.City, ShipTo.State, OrderDtl.XpartNum, OrderDtl.PartNum, OrderDtl.LineDesc, OrderRel.SellingReqQty, OrderRel.SellingJobShippedQty, OrderRel.SellingStockShippedQty FROM pub.Customer, pub.OrderHed, pub.OrderDtl, pub.OrderRel, pub.ShipTo, pub.ShipHead WHERE Customer.CustNum = OrderHed.CustNum AND Customer.Company = OrderHed.Company AND OrderHed.OrderNum = OrderDtl.OrderNum AND OrderHed.Company = OrderDtl.Company AND OrderDtl.Company = OrderRel.Company AND OrderDtl.OrderNum = OrderRel.OrderNum AND OrderDtl.OrderLine = OrderRel.OrderLine AND OrderRel.ShipToNum = ShipTo.ShipToNum AND OrderRel.Company = ShipHead.Company AND OrderRel.OrderNum = ShipHead.OrderNum AND Customer.Company = 'BTEST' AND Customer.CustNum = 6380 AND OrderHed.OpenOrder = 1 AND ShipTo.CustNum = 6380"


Thanks,



Rich Wagner



[cid:image002.jpg@...989C50]





412-384-3100

rwagner@...<mailto:rwagner@...>

www.bawplastics.com<http://www.bawplastics.com/>




[Non-text portions of this message have been removed]
Rich:

You have a typo:

OrderRel.ShipToNum = ShipTo.ShipToNum AND

You refer to the ShipTo table instead of the ShipHead table.

Lynn


--- In vantage@yahoogroups.com, "RICH WAGNER" <rwagner@...> wrote:
>
> Can anyone help me with creating a SQL statement for my VB script.
I need to left outer join the OrderRel and ShipHead table in the
following statement.
>
> mySQLvan = "SELECT OrderHed.OrderNum, OrderHed.PONum,
OrderRel.ShipToNum, OrderRel.ReqDate, OrderRel.NeedByDate,
OrderRel.ShipViaCode, OrderRel.Character01, ShipTo.Address1,
ShipTo.City, ShipTo.State, OrderDtl.XpartNum, OrderDtl.PartNum,
OrderDtl.LineDesc, OrderRel.SellingReqQty,
OrderRel.SellingJobShippedQty, OrderRel.SellingStockShippedQty FROM
pub.Customer, pub.OrderHed, pub.OrderDtl, pub.OrderRel, pub.ShipTo,
pub.ShipHead WHERE Customer.CustNum = OrderHed.CustNum AND
Customer.Company = OrderHed.Company AND OrderHed.OrderNum =
OrderDtl.OrderNum AND OrderHed.Company = OrderDtl.Company AND
OrderDtl.Company = OrderRel.Company AND OrderDtl.OrderNum =
OrderRel.OrderNum AND OrderDtl.OrderLine = OrderRel.OrderLine AND
OrderRel.ShipToNum = ShipTo.ShipToNum AND OrderRel.Company =
ShipHead.Company AND OrderRel.OrderNum = ShipHead.OrderNum AND
Customer.Company = 'BTEST' AND Customer.CustNum = 6380 AND
OrderHed.OpenOrder = 1 AND ShipTo.CustNum = 6380"
>
>
> Thanks,
>
>
>
> Rich Wagner
>
>
>
> [cid:image002.jpg@...]
>
>
>
>
>
> 412-384-3100
>
> rwagner@...<mailto:rwagner@...>
>
> www.bawplastics.com<http://www.bawplastics.com/>
>
>
>
>
> [Non-text portions of this message have been removed]
>