A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Android Security Essentials Live Lessons
this week in the
I'd like to select a customer that never made a sale
Joined: Aug 02, 2012
Oct 09, 2013 04:12:36
select c.CustomerID AS '客戶ID' , c.LastName AS '姓氏',FirstName AS '名字', c.FixedPhoneNumber AS '固定电话号码' from customer c INNER JOIN orders o ON (c.CustomerID = o.CustomerID) INNER JOIN order_details od ON (o.OrderID = od.OrderID) group by c.CustomerID having sum(od.NetSales) < 50000
As you see, if the customer never made a sale, the resultset will not be
included, how can I make it included?
Joined: Aug 22, 2010
Oct 09, 2013 04:20:11
An outer join should do the trick again, as it did
This time it is a bit more complicated, since you need to combine inner and outer joins in your query. I'd suggest googling
combining inner and outer join
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
subject: I'd like to select a customer that never made a sale
Stumped on a SQL Statement
SQLite abs yields results of nulls
How to get the last purchased product?
Same query, different results
Oracle : Inner Join syntax
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014