Topic: A question about find |
Print this page |
1.A question about find | Copy to clipboard |
Posted by: gaoxt1983 Posted on: 2006-11-08 17:23 I have three table : table A has many table B, table B has many table C, sometimes , I want to find all A 's data , and each A's row , I want to find all the B which meet the condition, which is a iteration. But my companymates warning me not to do that, because of effective. I should do that : select max(a.position_name) as pn, max(c.name) as dn, count(*) as c from position a, resume b, department c where a.id = b.position_id and a.department_id = c.id group by b.position_id I think this method is sick , but I don't know better, would anyone help me? |
2.Re:A question about find [Re: gaoxt1983] | Copy to clipboard |
Posted by: why Posted on: 2006-11-08 19:26 Your mate are right, avoid cursor (iteration) for RDBMS whenever possible. |
3.Re:A question about find [Re: gaoxt1983] | Copy to clipboard |
Posted by: gaoxt1983 Posted on: 2006-11-08 21:45 yep, I know that , but the sql make me sick , would you help me improve it ? PS:how to do this in Hibernate? |
4.Re:A question about find [Re: gaoxt1983] | Copy to clipboard |
Posted by: why Posted on: 2006-11-09 07:05 If this really make you sick, then you'd better stay away from SQL. |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |