Search
 
SCRIPT & CODE EXAMPLE
 

SQL

recursive query herarchical data sql server

WITH cte_org AS (
    SELECT       
        staff_id, 
        first_name,
        manager_id
        
    FROM       
        sales.staffs
    WHERE manager_id IS NULL
    UNION ALL
    SELECT 
        e.staff_id, 
        e.first_name,
        e.manager_id
    FROM 
        sales.staffs e
        INNER JOIN cte_org o 
            ON o.staff_id = e.manager_id
)
SELECT * FROM cte_org;
Code language: SQL (Structured Query Language) (sql)
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql command line top 10 
Sql :: shortcut run sql pgadmin 
Sql :: can we rollback data that are deleted using delete clause? 
Sql :: hive hbase create external table 
Sql :: contraint default SQL 
Sql :: hashpass 
Sql :: cursors in db2 
Sql :: leftjoin in sql 
Sql :: what is server_default = func.now() in sqlalchemy 
Sql :: mysql wait_timeout 
Sql :: teller stamp , bmo , PDF 
Sql :: mysql search like but first exact match 
Sql :: creating h2 database in relative directory eclopse 
Sql :: convert nvarchar to datetime sql 
Sql :: Postgresql select join by date - Join rows where a timestamp value is equal to midnight of the date 
Sql :: acceso denegado en msql 
Sql :: mysql missin expression near on 
Sql :: sql delete row from table where id 
Sql :: REFRESH command materialized view pgadmin example 
Sql :: mysql grant execute 
Sql :: data table footer customize 
Sql :: populate sql table with random data 
Sql :: how much table store postgres 
Sql :: python sql last insertend 
Sql :: sql to migration codeigniter online 
Sql :: import sheets doc into databricks 
Sql :: mysql c commands 
Sql :: does sql auto increment start at number if it is removed? 
Sql :: http://localhost:9200/_cluster/allocation/explain 
Sql :: mysql order two columns 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =