Thanks Ted, I switched it over to select ... from dual, and it worked quite nicely. I shall have to remember this for the future.
Mike -----Original Message----- From: Ted Schrader [mailto:[EMAIL PROTECTED] Sent: January 27, 2006 4:11 PM To: [email protected] Subject: Re: Select count(*) in a resultMap Hi Michael, You've got two options that I can think of off the top of my head. A. You execute each query separately, then cobble the results together "manually" in your Java code to build an instance of "ChannelCount". B. You craft a single query, assuming you have a master table for the channels (called Channels in this example): SELECT channel, (SELECT COUNT(*) FROM scrimbot_channels sc WHERE sc.channel = c.channel) AS existingCount, (SELECT COUNT(*) FROM scrimbot_pending_channels spc WHERE sc.channel = c.channel) AS pendingCount FROM Channels c You could use the query above for a queryForList(), or add a suitable WHERE clause for queryForObject(). If you don't have a "Channels" table, try changing the above query to hit the "dummy" table, which depends on your particular DBMS. Ted
