请问这个sql该怎么写???
(主表 企业表)表A (enterprise_id,enterparise_name,desc)
(子表 企业分布区域表) 表B (id,enterprise_id,region_Id,desc)
A 、B是1对N关系
现在需要通过region_Id(区域Id)查询企业,区域可以多选,请问该如何写SQL???
我写的sql中有重复(企业)的记录
select a.enterprise_id,b.region_id from A a,B b where a.enterprise_id=b.enterprise_id and
(b.region_id="01"or b.region_id="02")
请问改如何去掉重复的记录,(如果一个企业对应多个区域,区域可以任选其中一个)
谢谢!!!!!!!!