0
id_supplier를 제품 테이블에 저장하고 있습니다. 각 품목 코드에 대해 공급 업체 ID가있는 행 하나만으로 테이블에 표시 할 수 있습니다. 나는 또한 공급 업체의 이름이 필요하지만, ID와 이름을 구분할 때 문제가 있습니다.어떻게 group_concat 값을 데이터 테이블과 체크 박스로 루프 할 수 있습니까
//query
select code, group_concat(s.supplier_id,s.supplier_name) AS supplier_id_name
from catalog c
left join product p on p.product_id= c.product_id
left join supplier s on s.supplier_id = p.product_id
group by code;
//query will show following output
id supplier - 1, name - abc
id supplier - 2, name - def
Code | Supplier
A001 | 1abc,2def // id and name of supplier
은 내가 목적을 저장하기 위해 공급 업체의 ID를 포함 할 코드와 체크 박스에 대한 모든 공급 업체 디스플레이를위한 체크 박스가있을 것입니다
Code | Supplier
A001 | checkboxes value = 1 and then display supplier name beside....... and continue in the same row if more supplier
을 기대하고 무엇.
어떻게하면됩니까?
내 직감은 귀하의 프리젠 테이션 계층이 아니라 순수하게 MySQL에서. –
https://meta.stackoverflow.com/questions/333952/why-should-i-provide-an-mcve-for-what-seems-to-me-to-be-a-very-simple-sql- 질문. 덧붙여 말하자면, 대략적인 근사값으로, group_concat이 응답의 일부를 구성해야하는 sql에는 아무런 문제가 없습니다. – Strawberry