1个回答
test
2024-06-25
写的不太好,欢迎高手指点
select c.colno,c.colname,sc.idxname FROM syscolumns c
join SYSCONSTRAINTS sc on sc.tabid = c.tabid
join (
select idxname,part1 as colno from SYSINDEXES si where tabid=107 and part1 >0
union all
select idxname,part2 as colno from SYSINDEXES si where tabid=107 and part2 >0
union all
select idxname,part3 as colno from SYSINDEXES si where tabid=107 and part3 >0
union all
select idxname,part4 as colno from SYSINDEXES si where tabid=107 and part4 >0
union all
select idxname,part5 as colno from SYSINDEXES si where tabid=107 and part5 >0
union all
select idxname,part6 as colno from SYSINDEXES si where tabid=107 and part6 >0
union all
select idxname,part7 as colno from SYSINDEXES si where tabid=107 and part7 >0
union all
select idxname,part8 as colno from SYSINDEXES si where tabid=107 and part8 >0
union all
select idxname,part9 as colno from SYSINDEXES si where tabid=107 and part9 >0
union all
select idxname,part10 as colno from SYSINDEXES si where tabid=107 and part10 >0
union all
select idxname,part11 as colno from SYSINDEXES si where tabid=107 and part11 >0
union all
select idxname,part12 as colno from SYSINDEXES si where tabid=107 and part12 >0
) as t on t.colno = c.colno and t.idxname =sc.idxname
where c.tabid=107 and sc.constrtype = 'P'
回复
适合作为回答的
- 经过验证的有效解决办法
- 自己的经验指引,对解决问题有帮助
- 遵循 Markdown 语法排版,代码语义正确
不该作为回答的
- 询问内容细节或回复楼层
- 与题目无关的内容
- “赞”“顶”“同问”“看手册”“解决了没”等毫无意义的内容