For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > November 2005 > sql code left outer join









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author sql code left outer join
Raj

2005-11-21, 6:59 pm

Hi, I'm trying to left outer join two tables onto one. For some reason the
table is losing some of the left table data (vw_standard_costing_items).
Please can you tell me why, and a fix please?



I'm left outer joining

vw_standard_costing_budgeted_amount

and

vw_standard_costing_purchase_price

onto

vw_standard_costing_items




Thanks,

Raj (Newbie)



SELECT dbo.vw_standard_costing_items.No_,
dbo.vw_standard_costing_items.[Safety Stock Quantity],

dbo.vw_standard_costing_items.[Gen_ Prod_ Posting
Group], dbo.vw_standard_costing_items.Form,
dbo.vw_standard_costing_items.Description,

dbo.vw_standard_costing_items.[Description 2],
dbo.vw_standard_costing_items.[Vendor No_],
dbo.vw_standard_costing_budgeted_amount.Name,

dbo.vw_standard_costing_budgeted_amount.[Budgeted
Amount], dbo.vw_standard_costing_items.[Minimum Order Quantity],

dbo.vw_standard_costing_purchase_price.[Currency Code],
dbo.vw_standard_costing_purchase_price.[Direct Unit Cost],

dbo.vw_standard_costing_purchase_price.[Starting Date],
dbo.vw_standard_costing_purchase_price.[Ending Date],

dbo.vw_standard_costing_purchase_price.[Unit of Measure
Code]

FROM dbo.vw_standard_costing_items LEFT OUTER JOIN

dbo.vw_standard_costing_budgeted_amount ON

dbo.vw_standard_costing_items.[Vendor No_] =
dbo.vw_standard_costing_budgeted_amount.No_ LEFT OUTER JOIN

dbo.vw_standard_costing_purchase_price ON

dbo.vw_standard_costing_items.[Vendor No_] =
dbo.vw_standard_costing_purchase_price.[Vendor No_] AND

dbo.vw_standard_costing_items.No_ =
dbo.vw_standard_costing_purchase_price.[Item No_]


Hilarion

2005-11-21, 6:59 pm

> Hi, I'm trying to left outer join two tables onto one. For some reason the
> table is losing some of the left table data (vw_standard_costing_items).
> Please can you tell me why, and a fix please?
>
> [snip]



Why did you post to "alt.php.sql"? Does the select statement work OK
in some external application and does not work OK in PHP?
Why did you post to so many different "microsoft.public.sqlserver.*"
groups? "microsoft.public.sqlserver.programming" should be
enough.

What data from "vw_standard_costing_items" is missing from the
output?


Hilarion
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com