SQL Query to bring up Counts for Users in the European Union

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
User avatar
calvis
Rear Admiral (RADM)
Rear Admiral (RADM)
Posts: 710
Joined: Tue Jan 27, 2004 3:57 pm
Location: Redmond, WA

SQL Query to bring up Counts for Users in the European Union

Post by calvis » Mon Jan 30, 2017 1:29 pm

We are using Ablecommerce Gold. We are looking for a SQL query to show us the count of registered users from the European Union.

I can do it a query for each country, but I can't figure how to do it for a group on countries. I need the number of users separated by country.

This information would be helpful in determining if it's feasible to setup a EU distribution point.
Able Customer Since 1999 Currently Running on GOLD R12 SR1 and PCI Certified.

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: SQL Query to bring up Counts for Users in the European Union

Post by jmestep » Tue Jan 31, 2017 12:38 am

What about setting up a zone and using a join to that? Just a zone for convenience, not for shipping. Or a string of EU country abbreviations and use an in('FR',DE')
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: SQL Query to bring up Counts for Users in the European Union

Post by david-ebt » Thu Feb 02, 2017 3:58 am

If you're working directly in SQL, you can this query:

Code: Select all

select c.Name, COUNT(*) as NumUsers
from ac_Users u
join ac_Addresses a on u.UserId = a.UserId and a.IsBilling = 1
join ac_Countries c on a.CountryCode = c.CountryCode
where u.IsApproved = 1 and u.IsAnonymous = 0
group by c.Name
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

User avatar
calvis
Rear Admiral (RADM)
Rear Admiral (RADM)
Posts: 710
Joined: Tue Jan 27, 2004 3:57 pm
Location: Redmond, WA

Re: SQL Query to bring up Counts for Users in the European Union

Post by calvis » Thu Feb 02, 2017 8:01 am

I am using Web2Market's Report Wizard so I can do SQL inside of Ablecommerce.

That was a very nice query. It gave me info that I was looking for plus more.

Thanks,

-Charles
Able Customer Since 1999 Currently Running on GOLD R12 SR1 and PCI Certified.

Post Reply