File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Elasticsearch in Action
this week in the
JDBC and Relational Databases
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
I agree. Here's the link:
subject: I'd like to select a customer that never made a sale
Stumped on a SQL Statement
Oracle : Inner Join syntax
Same query, different results
How to get the last purchased product?
SQLite abs yields results of nulls
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015