- 论坛徽章:
- 0
|
三张表
A表 id,userID,date,money
B表 id,userID,date,money
C表 id,userID,date,money
查询三张表的记录 userID = userID = userID = ‘某一个值’ 而且 根据date排序
在ibatis框架的配置文件中怎么写?
解答:- <select id="select1" parameterClass="string" resultClass="com.test.Bean">
- select * from (
- select
- t1.id,t1.userId,t1.date,t1.money
- from
- A t1
- where
- t1.id = #value#
- union all
- select
- t1.id,t1.userId,t1.date,t1.money
- from
- B t1
- where
- t1.id = #value#
- union all
- select
- t1.id,t1.userId,t1.date,t1.money
- from
- C t1
- where
- t1.id = #value#
- ) m
- order by m.date
- </select>
复制代码 转自:http://bbs.ibeifeng.com/read-htm-tid-65928.html |
|