パスワードを忘れた? アカウント作成
504378 journal

kogepanmanの日記: SQL Anywhere 9 で階層問い合わせ

日記 by kogepanman
drop table recur;
create table recur (
p char(5),
c char(5));

insert into recur
select 'A', 'AA' union all
select 'A', 'AB' union all
select 'A', 'AC' union all
select 'AA', 'A1' union all
select 'AA', 'A2' union all
select 'B', 'BA' union all
select 'BA', 'B1' union all
select 'BA', 'B2' union all
select 'B1', 'B1-1' union all
select 'B1', 'B1-2' union all
select 'B1', 'B1-3';

with recursive vrecur (p, c) as (
    select p, c from recur where p = 'b'
        union all
    select t.p, t.c
    from vrecur r join recur t on r.c = t.p
)
select c from vrecur;

設定でそうなっているのか'A' = 'a'となってしまってはまってしまった。

typodupeerror

人生unstable -- あるハッカー

読み込み中...