日期:2014-05-17 浏览次数:20694 次
--你的表是什么,换了就可以了 select categories_id from mc_categories where categories_status = 1 and exists (select categories_no from 你的表 where parent_id='{$parent_id}' and mc_categories.categories_no like 你的表.categories_no+'%')
------解决方案--------------------
这个我没试过这样
但我可以给你个建议
用一个文本框 或是什么控件
parent_id = parent.text
然后再 select categories_id from mc_categories where categories_status = 1 and categories_no like 'parent_id%'
------解决方案--------------------
select categories_id from mc_categories where categories_status = 1 and categories_no like (select categories_no where parent_id=@parent_id)+'%'
------解决方案--------------------
--mssql写法 declare @parent_id varchar(12) set @parent_id='000123456789' select categories_id from mc_categories where categories_status = 1 and exists (select categories_no from tb where parent_id=@parent_id and mc_categories.categories_no like tb.categories_no+'%')