Che,

Try this:

SELECT count(total) as sourcetotal, source
FROM (
select count(*) as total, source
from listings
group by source

union all

select count(*) as total, source
from speclistings
group by source

union all

select count(*) as total, source
from psportlistings
group by source
)
GROUP BY source
ORDER BY source DESC

Sincerely,

Dave Phillips
http://www.dave-phillips.com

-----Original Message-----
From: Che Vilnonis [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 19, 2008 9:11 AM
To: CF-Talk
Subject: (ot) SQL question...

Hello all. I'm looking to output the total number of entries, grouped by
source from 3 tables. I'd like to modify the sql below so that each source
shows up only once, yet tablulates the totals from all of the tables. Any
ideas. Thanks, Che.

-------------------

select count(*) as total, source
from listings
group by source

union all

select count(*) as total, source
from speclistings
group by source

union all

select count(*) as total, source
from psportlistings
group by source

order by total desc





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311248
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to