I've done this two different ways, one is to have a script that runs on a nightly basis and summarizes the tracking data which allows me to order by domain. This is all done in php and requires and extra table to hold the summarized data.
To do it on the fly so to speak, you can try using a rather ugly and brutal query I wrote.
Code:
select count(referrer) as refcount, referrer, Left(referrer, LOCATE('/',referrer, LOCATE('/',referrer, LOCATE('/',referrer, LOCATE('/',referrer,0)+1)+1)+1)) as domainref from tracksection group by Left(referrer, LOCATE('/',referrer, LOCATE('/',referrer, LOCATE('/',referrer, LOCATE('/',referrer,0)+1)+1)+1)) having (referrer Not Like '%mydomain.com%' AND referrer != '') order by refcount desc
If you replace 'referrer' with the field that holds your domain info and 'tracksection' with your table name, then the query should work. I know its rather ugly looking but it gets the job done in a pinch. lol I also have the mydomain.com in there in case your domains are listed (if you track internal pages as well) and you wish to weed them out. If you don't need this you can just take out the entire 'having ...' section.