Zen Cart Logo
Forums / All Other Contributions/Addons / Cool Idea/Question About Demographic Add-ons

Cool Idea/Question About Demographic Add-ons

Locked

Views: 712

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
19 Nov 2008, 3:45 AM
#1
bigsash avatar

bigsash

New Zenner

Join Date:
Nov 2008
Posts:
17
Plugin Contributions:
0

Cool Idea/Question About Demographic Add-ons

This may be ridiculous, forgive me if it is or this already exists.

My goal/idea is to have a way to extract demographic summaries about the customers in my store. At the very least to get average age based on DOB.

Does anyone know of an add-on that does this?

Does anyone know of a way to export the info I would need to compute the avg age without having to look at each customer record to transcribe the DOB?

Thanks!

19 Nov 2008, 6:59 AM
#2
hugo13 avatar

hugo13

Zen Follower

Join Date:
Apr 2004
Location:
vienna
Posts:
176
Plugin Contributions:
4

Re: Cool Idea/Question About Demographic Add-ons

use a sql-statement like

SELECT AVG((YEAR(CURDATE())-YEAR(customers_dob)) - (RIGHT(CURDATE(),5)<RIGHT(customers_dob,5))) AS age 
FROM zen_customers WHERE customers_dob > 0

OR ```php
SELECT AVG(DATE_FORMAT(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS(customers_dob)), '%Y')+0) AS age
FROM zen_customers WHERE customers_dob > 0;


MYSQL::<http://dev.mysql.com/doc/refman/5.0/en/date-calculations.html>