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
 Database Design and Application Architecture
 Lab question

Author  Topic 

Fez_0
Starting Member

1 Post

Posted - 2007-10-15 : 18:37:53
K so i have this question for my lab and i can ONLY use Inner join


--B) Select the carriers first name, last name, and the number of customers they serve



--This is the coding i did for it.....

Select "Carrier Name" = Carrier.FirstName + space(1) + Carrier.LastName,
"Number of Customers" = count(Customer.CustomerID) from Carrier
inner join Route on Carrier.CarrierID = Route.CarrierID
inner join Customer on Route.RouteID = Customer.RouteID
group by Carrier.FirstName, Carrier.LastName
order by count(Customer.CustomerID)


alright, soo when i execute it..it ONLY shows the carriers whose customer numbers are greater than ZERO. i need to figure out howw i can display the carrier with zero customers

Kristen
Test

22859 Posts

Posted - 2007-10-15 : 22:35:37
Change

inner join Customer on Route.RouteID = Customer.RouteID

to

LEFT OUTER join Customer on Route.RouteID = Customer.RouteID

Kristen
Go to Top of Page

mwjdavidson
Aged Yak Warrior

735 Posts

Posted - 2007-10-18 : 06:49:10
Why can you only use inner join?

Mark
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-18 : 06:54:33
Are you allowed to use UNION?



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-10-18 : 07:03:58
"Why can you only use inner join?"

Missed that bit
Go to Top of Page
   

- Advertisement -