Rabu, 16 November 2016

Re: [MS_AccessPros] Seems Simple

 

Paco-


You can find the answer in our upcoming Effective SQL book.  What you need is:

SELECT tblShop.*, (SELECT COUNT(Shop) FROM tblJob WHERE tblJob.Shop = tblShop.Shop) AS JobCount
FROM tblShop;

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Nov 16, 2016, at 10:27 PM, paco6945@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



I have 2 tables:  Shop and Job. I need a query that will return a count of jobs, by shop. The problem is that sometimes for a given date range, the shop has no jobs. If I join the tables on Shop (FROM tblJob RIGHT JOIN tblShop ON tblJob.Shop = tblShop.Shop), the shop that has no jobs isn't included in the record set. I need to include the shop with a count of zero.


I've drawn a blank (although I'm certain I have resolved this before).


Any ideas?


Paco





__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar