CREATE VIEW v_LOList 
AS 
SELECT 
   c.LOID AS ParentID,
   c.LOTitle AS ParentName,
   c.foreignID AS ParentForeignID,
   l.RealLOID AS RealID,
   l.LOType AS Type,
   l.LOID AS ChildID,
   l.LOTitle AS ChildName,
   l.foreignID AS ChildForeignID, 
   r.sort_no AS sort_no 
 FROM 
   LORelation r, 
   LO l, 
   LO c 
 WHERE 
   l.LOID = r.childID 
  AND 
   c.LOID = r.parentID 
  AND 
   c.LOType = 0 
