Link to home
Start Free TrialLog in
Avatar of srikotesh
srikotesh

asked on

how can i write mysql query in an effective way

HI Experts,

How can i write below query in simple and effective way:

query:
Select CI_ID,@pv:=CI_parent_CI as parentid from (select CI_ID,CI_parent_CI from master order by CI_ID desc) as master join (select @pv:=236283) tmp where CI_ID=@pv;

the above query will give list of ids which are parent to 236283

Ex:
i passed 236283
parents are :236282--->parentof(236282)--->236281

is there any alternative way to get this result,why because i have to convert this query to hibernate hql.
the above query will not support in hibernate.
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial