同一个sql中显示同一个字段的3个值,以第一个结果作为第二个结果的条件,第二个结果作为第三个结果的条件。怎么优化
例如:
select dictid from T where tid='1010104030403'; --10101040304
select dictid from T where tid='10101040304'; --101010403
select dictid from T where tid='101010403'; --1010104
select dictid level1,(select dictid from T where tid=(select dictid from T where tid='1010104030403')) level2,
(select dictid from T where tid=(select dictid from T where tid=(select dictid from T where tid='1010104030403'))) level3 from T where tid='1010104030403';