ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sophia" <jde...@telenet.be>
Subject Re: Problem with my query.
Date Thu, 19 Jun 2008 14:06:19 GMT
Thanks for your repley,

The problem is, I dont know how to build this query in Ibatis.

select * from ACCOUNT where NUMBER in
(select NUMBER from ACCOUNT where substr(ACCOUNT,5,4) between '2002' and 
'2006')

This must be build in ibatis. The question is, i have not yet build something like this with
a "in" statement as query.
The query at the end of my previous message is just a piece of it.
I use DB2 as database.

Regards,
Sophia


>----- Oorspronkelijk bericht -----
>Van: David_Greenberg@ltx.com [mailto:David_Greenberg@ltx.com]
>Verzonden: donderdag, juni 19, 2008 03:11 PM
>Aan: user-java@ibatis.apache.org
>Onderwerp: Re: Problem with my query.
>
>I'm not entirely sure what you're trying to do, as that query at the end 
>of your message looks like a good solution to me.  It sounds like you are 
>trying to do something more complicated.  Depending on your DBMS, you can 
>try something like this:
>
>select ACCOUNT.* from ACCOUNT,
>        (select NUMBER from ACCOUNT where substr(ACCOUNT, 5, 4) between 
>'2002' and '2006') NUM
>where ACCOUNT.NUMBER = NUM.NUMBER
>
>I'm sure any number of people can give you any number of ways to optimize 
>this.  Is the error that you get coming from your DBMS or ibatis?
>
>-David
>
>
>
>From:
>"Sophia" <jdev02@telenet.be>
>To:
>user-java@ibatis.apache.org
>Date:
>06/19/2008 08:55 AM
>Subject:
>Problem with my query.
>
>
>
>Hallo everyone, 
>
>I have a problem with my query, can someone help me further
>This is the query that I want to use in ibatis.
>
>select * from ACCOUNT where NUMBER in
>(select NUMBER from ACCOUNT where substr(ACCOUNT,5,4) between '2002' and 
>'2006?)
>
>
>This is my source:
>
>
>try {
>dao.ACCOUNTDAO accountList2Dao = 
>(dao.ACCOUNTDAO)DaoManagerRequester.getDaoManager().getDao(dao.ACCOUNTDAO.class);
>model.ACCOUNTExample account2Example = new model.accountExample(); 
> 
>List resultList6 = accountList2Dao.selectByAccountList2(account2Example);
>account2Example.createCriteria().andNumberDateBetween(startdate, enddate);
> 
>List resultList6 = accountList2Dao.selectByAccountList2(account2Example);  
> 
>...
>
>} catch ...
>
>
>This works, and it gives me this:
>
>select * from ACCOUNT where substr(ACCOUNT,5,4) between '2002' and '2006'
>
>
>Any suggestions?
> 
>
>Regards,
>Sophia
>
>
>
>
>



Mime
View raw message