select t1.*
from (
         SELECT distinct t1.userid,
                         t2.name,
                         t2.accountno,
                         t2.phonenumber,
                         t3.enterprisename,
                         t1.enddate,
                         t1.begdate,
                         t1.price,
                         t5.partitionname
         from sys_payorderitems t1
                  INNER JOIN sys_users t2 ON t2.userid = t1.userid
                  inner JOIN sys_enterprise t3 ON t3.sys_enterpriseid = t1.sys_enterpriseid
                  left JOIN sys_payorder t4 on t4.sys_payorderid = t1.sys_payorderid and t4.siteid = t1.siteid
                  LEFT JOIN sys_site_systempartition t5
                            ON t5.sys_site_systempartitionid = t4.sys_site_systempartitionid and
                               t5.siteid = t4.siteid
         WHERE t1.sys_payorderid = $sys_payorderid$
           and t1.siteid = $siteid$
           and $where$
     ) t1