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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Select Query in Northwind Database
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

3 Posts

Posted - 03/13/2013 :  09:53:07  Show Profile  Reply with Quote
Hi All-

I'm learning OLAP modelling.In this context i have decided to use northwind database for creating Star schema.I want to select the below fields using Northwind database,these fields will be used to create Order fact table.

OrderID,ProductID,UnitPrice,Quantity,Discount,Customer ID,Employee ID,Supplier and Order Date.

I tried querying using the below query.However,as am not good at SQL i'm unable to fine tune this query.

SELECT distinct

from [Order Details] od inner join Orders o on od.OrderID=o.OrderID ,
Employees e JOIN Orders ON (e.EmployeeID = Orders.EmployeeID),
Products p JOIN Suppliers ON (p.ProductID= Suppliers.SupplierID)
Suppliers S JOIN Products ON (S.SupplierID = Products.SupplierID).

Can someone provide me correct query to pull the above mentioned field.

Thanks for your help in advance.


Flowing Fount of Yak Knowledge

6065 Posts

Posted - 03/13/2013 :  14:29:05  Show Profile  Reply with Quote
I don't have the Northwind database but I'm guessing you want something like this for your FROM clause.

from   orders o
inner join orderDetails od
       on od.orderid = o.orderid
inner join products p 
       on p.productid = od.productid
inner join suppliers s
       on s.supplierid = p.supplierid
inner join Employees e 
       on e.EmployeeID = o.EmployeeID

Be One with the Optimizer
Go to Top of Page

Starting Member

3 Posts

Posted - 03/14/2013 :  09:11:50  Show Profile  Reply with Quote
Thanks for help
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000