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
 General SQL Server Forums
 New to SQL Server Programming
 Using Join with sql Server

Author  Topic 

rino_abraham
Starting Member

1 Post

Posted - 2011-08-26 : 07:36:14

Using Northwind database.

I want to use "Outer Join" query with the same below code i am getting error while using outer join where inner join are there.


select top 5 sum (quantity*unitprice) as ordervalue,customers.CustomerID,customers.CompanyName from [order details]
inner join orders on [order details].orderid=orders.orderid
inner join customers on [orders].customerid=customers.customerid
group by customers.customerid,customers.companyname
order by 1 desc

Kristen
Test

22859 Posts

Posted - 2011-08-26 : 07:48:53
" i am getting error "

What error message?

If OUTER JOIN to [order details], and there are no records, you will get NULL for quantity & unitprice, which will give you a warning that your aggregate SUM() includes some NULL values

Please show the actual code that generates error, and the error message you got.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-26 : 08:01:06
why do you think you need to use OUTER JOIN? what exactly is your requirement? post some sample data to illustrate it and then output you want

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -