|
|
当前位置:首页 > > 将借书记录和还书记录和遗失记录合并显示 |
将借书记录和还书记录和遗失记录合并显示(借书记录和还书记录在同一表BOOKSLEND) SELECT addtime,code,title,lendman,lendtime,retutime,state,0 as state_1,0 as state_2 FROM BOOKSLEND where state='0' and code like '%BOOI201105050001%' UNION all SELECT addtime,code,title,lendman,lendtime,retutime,0,state,0 FROM BOOKSLEND where state='1' and code like '%BOOI201105050001%' UNION all SELECT addtime,code,title,lendman,lendtime,retutime,0,0,num FROM BOOKSLOST where code!='0' and code like '%BOOI201105050001%'
addtime(时间) |
code(编号) |
title(图书名称) |
lendman |
lendtime(借书时间) |
retutime(还书时间) |
state(借数) |
state_1(还数) |
state_2(遗失数) |
2011-06-24 10:03:00 |
BOOI201105050001 |
.NET案例大全 |
王五 |
2011-06-24 00:00:00
|
NULL |
0 |
0 |
0 |
2011-06-24 10:03:00 |
BOOI201105050001 |
.NET案例大全 |
王五 |
2011-06-23 00:00:00
|
2011-06-24 00:00:00
|
0 |
1 |
0 |
2011-05-21 14:32:00
|
BOOI201105050001 |
.NET案例大全 |
NULL |
NULL |
NULL |
0 |
0 |
1 |
|
|