我有两个桌子
export default {
...
get event() { return event; },
}
现在我想在下面提到细节
BUSINESS_ID SUBCATEGORY_NAME MAINCATEGORY_NAME
但是我不知道该怎么办?
答案 0 :(得分:1)
select
bus.business_id, cat2.name as subcategory_name, cat1.name as maincategory_name
from
business_categories as bus
inner join categories as cat1 on bus.category_id = cat1.id
inner join categories as cat2 on cat1.parent_id = cat2.id