ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Maves <Nathan.Ma...@Sun.COM>
Subject Re: Multiple select queries in one select tag
Date Thu, 04 Aug 2005 13:11:52 GMT
I understand that :)  But in this case you would be combining  
something like em_num with dept_num.  In this case you would have to  
place dummy columns with either a null of 0 as a place holder.  I  
still think that my join is way cleaner and more performant.

Nathan

On Aug 4, 2005, at 12:42 AM, Eugeny N Dzhurinsky wrote:

> On Wed, Aug 03, 2005 at 09:25:24PM -0000, sreenivas wrote:
>
>> Hi,
>>
>> I would like to know whether or not below approach is possible  
>> with iBATIS.
>>
>> <select id ="getEmpDetails" parameterClass = "com.abc.Input"  
>> resultClass =
>> "com.abc.Output"> select emp_name as eName, emp_sal as eSal from  
>> emp where
>> emp_id = #emp_id# and loc_code=#loc_code#
>> select dept_no as eDeptNo from dept where emp_id = #emp_id# and
>> loc_code=#loc_code# </select>
>> As in the above code, both queries take inputs from same parameter  
>> class,
>> and trying to map results too in the same result class.
>>
>> I know there are other ways to do that, but would like to know  
>> possibility
>> of executing multiple select statements in 1 <select> mapping, and
>> populating results of both the queries into same result object.
>>
>
> select ... from ... where ... union select ... from ... where ... etc
> =)
>
> -- 
> Eugene N Dzhurinsky
>


Mime
View raw message