Display one to many mapping
10:44 24 Apr 2013

I have to tables

Tasks:
 id
 title
 Description

Task_reply_mapping
task_id
parent_id

I have written the following query to get the data

    select t1.id,t1.title,t1.description,t2.id,t2.title,t2.description
from tasks t1
left join Task_reply_mapping trm on t1.id =  trm.task_id 
    left join tasks t2 on t2.id = t1.id
    order by fe.created_at desc limit 0,10

This seems to be working fine but its not populating the data correctly. I want to know if this query is correct?

In my mapper file I have

  
    
    
    
  
    
        
        
   
  
   

Or I am doing something wrong in mapper class.

Records in objects are placed like at first index its putting the latest task whether its reply or new task and so on.

It should insert records like this

   Task1
     --1st reply task
     --2nd reply task
  Task 2
      --1st reply task
      --2nd reply task
sql mysql mybatis