Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Inner Join Problem

Author  Topic 

mlawton40
Starting Member

15 Posts

Posted - 2007-04-19 : 06:27:47
Hi, I have the following select statement:


SELECT
OrderLine_Status.Description + ' ' + MSL_Status.Description AS Status,
Product.MSL_MSDesc,
OrderLine.OrderQty,
OrderLine.TotalCost,
OrderLine.DespatchDateTime,
OrderLine.DeliveryDateTime
FROM OrderLine
INNER JOIN OrderLine_Status ON OrderLine_Status.Status = OrderLine.Status
INNER JOIN Product ON Product.ProductId = OrderLine.ProductId
INNER JOIN MSL_Status ON MSL_Status.Action_code = OrderLine.Action_code
WHERE (OrderLine.OrderRef = @OrderRef)[


But if the action code is null in my OrderLine table the sql does not display any rows.

Any help would be great!

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-04-19 : 06:32:20
quote:
Originally posted by mlawton40

Hi, I have the following select statement:


SELECT
OrderLine_Status.Description + ' ' + MSL_Status.Description AS Status,
Product.MSL_MSDesc,
OrderLine.OrderQty,
OrderLine.TotalCost,
OrderLine.DespatchDateTime,
OrderLine.DeliveryDateTime
FROM OrderLine
INNER JOIN OrderLine_Status ON OrderLine_Status.Status = OrderLine.Status
INNER JOIN Product ON Product.ProductId = OrderLine.ProductId
INNER JOIN MSL_Status ON MSL_Status.Action_code = OrderLine.Action_code or OrderLine.Action_code IS NULL
WHERE (OrderLine.OrderRef = @OrderRef)


But if the action code is null in my OrderLine table the sql does not display any rows.

Any help would be great!



Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -