//WHERE `Status`=0 AND FIND_IN_SET(Id,@pid) > 0 ",query.QCateIds);
builder.AppendFormat(@"
builder.AppendFormat(@"
SELECT tabA.*
SELECT * FROM rb_share_category WHERE `Status`=0 AND ParentId IN({0})
FROM (SELECT * FROM rb_share_category WHERE `Status`=0 AND ParentId>0) tabA,
UNION ALL
(SELECT @pid := '{0}') pd
SELECT * FROM rb_share_category WHERE `Status`=0 AND ParentId IN(SELECT Id FROM rb_share_category WHERE `Status`=0 AND ParentId IN({0}) )
WHERE FIND_IN_SET(ParentId, @pid) > 0 AND @pid := concat(@pid, ',', id)
UNION ALL
UNION
SELECT * FROM rb_share_category WHERE `Status`=0 AND ParentId IN(SELECT Id FROM rb_share_category WHERE `Status`=0 AND ParentId IN( SELECT Id FROM rb_share_category WHERE `Status`=0 AND ParentId IN({0})) )
SELECT *
UNION ALL
FROM rb_share_category
SELECT * FROM rb_share_category WHERE `Status`=0 AND Id IN({0})
WHERE `Status`=0 AND FIND_IN_SET(Id,@pid) > 0 ",query.QCateIds);