team-lupin / plan

0 stars 0 forks source link

3/26 회의록 #9

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

회의 일시 / 방식 / 진행자 / 참여 인원


회의 내용

지난주 논의

김병국


다음주 계획

전체


다음 회의 날짜 / 시간

jyyo0n commented 1 year ago

category example

root@localhost:lupin_dev 03:00:39>select * from category_item_dtl; +-------------+---------+ | category_id | item_id | +-------------+---------+ | 1 | 12345 | | 1 | 123456 | | 2 | 777777 | +-------------+---------+ 3 rows in set (0.000 sec)

111 (의류 조회)

root@localhost:lupin_dev 03:00:50>WITH RECURSIVE cte AS ( -> SELECT category_id, name -> , parent_id -> FROM category_mst -> WHERE category_id = 111 -> UNION ALL -> SELECT c.category_id, c.name -> , c.parent_id -> FROM category_mst c -> INNER JOIN cte -> ON cte.category_id = c.parent_id -> ) -> SELECT * -> FROM cte, category_item_dtl a -> where cte.category_id = a.category_id; +-------------+--------------+-----------+-------------+---------+ | category_id | name | parent_id | category_id | item_id | +-------------+--------------+-----------+-------------+---------+ | 1 | 남성의류 | 111 | 1 | 12345 | | 1 | 남성의류 | 111 | 1 | 123456 | | 2 | 여성의류 | 111 | 2 | 777777 | +-------------+--------------+-----------+-------------+---------+ 3 rows in set (0.001 sec)

1 (남성의류)

root@localhost:lupin_dev 03:01:05>WITH RECURSIVE cte AS ( -> SELECT category_id, name -> , parent_id -> FROM category_mst -> WHERE category_id = 1 -> UNION ALL -> SELECT c.category_id, c.name -> , c.parent_id -> FROM category_mst c -> INNER JOIN cte -> ON cte.category_id = c.parent_id -> ) -> SELECT * -> FROM cte, category_item_dtl a -> where cte.category_id = a.category_id; +-------------+--------------+-----------+-------------+---------+ | category_id | name | parent_id | category_id | item_id | +-------------+--------------+-----------+-------------+---------+ | 1 | 남성의류 | 111 | 1 | 12345 | | 1 | 남성의류 | 111 | 1 | 123456 | +-------------+--------------+-----------+-------------+---------+ 2 rows in set (0.001 sec)