Hi Mike, I'm glad I could help.
Obviously, in my listing of options to try, I skirted the direct issue of why your nested selects wouldn't work. To be honest, it seems like your configuration should have worked, and I have no idea why it didn't (but I'm not too experienced with SqlMaps yet). Again, I'm glad the simpler SqlMaps config coupled with a slightly more-complicated query is working. Plus, the query is now a single hit to the DB. Ted On 28/01/06, Michael Laccetti <[EMAIL PROTECTED]> wrote: > 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 > > > >
