HestonJames
Programmer
Hello Guys,
I'm looking for some help on this query:
This runs just fine and produces a fair result, it gives me a full list of all the different account types with a count of how many accounts are of that particular type. It even lists account types which don't have any accounts under them with a count of 0... perfect!
What I wish to do is add a condition so that it only counts accounts which are from a particular region. So I've amended the query like so:
Now, this will only display account types which have accounts under them whereas before it would list ALL account types, regardless of whether it had accounts under it.
Can anyone suggest what I'm doing wrong?
Thanks,
Heston
I'm looking for some help on this query:
Code:
Select Account_Type.Name,
Count(Account.Account_ID) As Accounts
From Account_Type
Left Outer Join Account On Account_Type.Account_Type_ID = Account.Account_Type_ID
Group By Account_Type.Name
This runs just fine and produces a fair result, it gives me a full list of all the different account types with a count of how many accounts are of that particular type. It even lists account types which don't have any accounts under them with a count of 0... perfect!
What I wish to do is add a condition so that it only counts accounts which are from a particular region. So I've amended the query like so:
Code:
Select Account_Type.Name,
Count(Account.Account_ID) As Accounts
From Account_Type
Left Outer Join Account On Account_Type.Account_Type_ID = Account.Account_Type_ID
[b]Where Account.Region_Id = '3236f8f0-2c55-11df-8a39-0800200c9a66'[/b]
Group By Account_Type.Name
Now, this will only display account types which have accounts under them whereas before it would list ALL account types, regardless of whether it had accounts under it.
Can anyone suggest what I'm doing wrong?
Thanks,
Heston