SELECT id
FROM (
SELECT *
FROM ty_hotel_product
WHERE parent_product_id > 0

ORDER BY parent_product_id DESC
) realname_sorted, (
SELECT @pv := 2
) initialisation
WHERE FIND_IN_SET(parent_product_id, @pv) > 0
AND (@pv := concat(@pv, ',', id))




select id from (
select t1.id,
if(find_in_set(parent_product_id, @pids) > 0, @pids := concat(@pids, ',', id), 0) as ischild
from (
select id,parent_product_id from ty_hotel_product t where t.status = 1 order by parent_product_id, id
) t1,
(select @pids := 1) t2
) t3 where ischild != 0

相关文章:

  • 2022-02-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-18
猜你喜欢
  • 2022-01-07
  • 2022-01-01
  • 2021-08-14
  • 2022-12-23
  • 2022-12-23
  • 2021-08-23
  • 2022-02-26
相关资源
相似解决方案