Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql 5.6 hierarchical recursive query

select  id,
        name,
        parent_id 
from    (select * from products
         order by parent_id, id) products_sorted,
        (select @pv := '19') initialisation
where   find_in_set(parent_id, @pv)
and     length(@pv := concat(@pv, ',', id))
Comment

PREVIOUS NEXT
Code Example
Sql :: how to delete user sql server 
Sql :: how to comment in sql 
Sql :: make parameters nullable in sql server 
Sql :: mysql group by 
Sql :: mysql is odd 
Sql :: change password in mysql 
Sql :: t-sql add column 
Sql :: change database postgres 
Sql :: what is cursor in sql server with example 
Sql :: sql distinct vs unique 
Sql :: dump multiple tables mysql 
Sql :: sql as 
Sql :: sql max min 
Sql :: postgresql delete cascade 
Sql :: postgres stored procedure 
Sql :: SQL INNER JOIN With Three Tables 
Sql :: SQL get max per id 
Sql :: sql use with to get value counts and percentages 
Sql :: time in sql server 
Sql :: mysql grouping functions 
Sql :: insert using condition postgres 
Sql :: sql order 
Sql :: mysql get table column names and data types 
Sql :: sql with as 
Sql :: greater than or equal to symbol in postgres 
Sql :: mysql having 
Sql :: foreign key in sql dbms 
Sql :: mysql create table 
Sql :: insert command in sql 
Sql :: insert data to postgresql from excel 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =