CategoryComputingTips > SQLCompTips
SQL Tips
This is more a collection of recipes than tips I guess.
Tip 1
SELECT COUNT(substring),substring FROM ( br SELECT SUBSTRING(domainname FROM POSITION('.' in domainname)) FROM orders WHERE type=1) AS foo br GROUP BY substring;
Group and count domain extensions.