Home > database >  Mysql multi-stage classification tree structure data derived by using the stored procedure
Mysql multi-stage classification tree structure data derived by using the stored procedure

Time:09-26

According to tree structure of pid query nodes at all levels, structure and data table below

CodePudding user response:

You can write SQL don't satisfy you

CodePudding user response:

I want to get rid of classification are repeated, as the first column with multiple "mobile phone/digital" field

CodePudding user response:

Praise zambrotta
I use excel classification, remove the duplicate

CodePudding user response:

Select
Case the when @ rownum:=@ rownum + 1=1 then t1. Name the else null end as the name,
T1. ` name `, t1. Id, t1. ` name `, t1. Id, t1. ` name `, t1. Id, t1. ` name `, t1. Id, t1. ` name `, t1. Id
The from
(
The SELECT a. ` name `, Anderson d, b. ` name `, b.i d, c. ` name `, c.i d, d. ` name `, d.i d, e. ` name `, e.i d
The FROM b_product_category a
LEFT the JOIN b_product_category b ON p. Id=Anderson d
LEFT the JOIN b_product_category c ON c.p Id=b.i d
LEFT the JOIN b_product_category d ON d.p Id=c.i d
LEFT the JOIN b_product_category e ON e.p Id=d.i d
WHERE Amy polumbo Id=0
The ORDER BY a.o rderid, b.i d, c.i d, d.i d, e.i d
T1, t2 (select @ rownum:=0)

Why do you try to see can implement specific can realize myself and a little circle
I also to smooth your,,,
  • Related