问题描述
C_Doc_Code c_Product_Code n_priority
D94334 BR00004 1
D94335 BR00012 1
D94335 BR00049 2
D94335 BR00047 3
D94335 BR00047 3
D94336 I00001 4
D94336 BR00054 5
D94336 BR00052 2
D94336 BR00052 2
D94337 BR00001 1
D94337 BR00001 1
请深入了解表中的一些医生代码,在第二列中首先提供产品代码2次。请告诉我们如何仅提取那些医生代码以及产品代码..
C_Doc_Codec_Product_Coden_priority
D94334 BR00004 1
D94335 BR00012 1
D94335 BR00049 2
D94335 BR00047 3
D94335 BR00047 3
D94336 I00001 4
D94336 BR00054 5
D94336 BR00052 2
D94336 BR00052 2
D94337 BR00001 1
D94337 BR00001 1
Please obsereve the table deeply some doctor codes in column first having product codes 2 times in second column..pls tell how to extract only those doctor codes along with product code..
推荐答案
select distinct c_doc_code, c_product_code from table1 t1 where
(
select count(*) from table1 t2 where t2.c_product_code=t1.c_product_code
) > 1
这篇关于如何多次选择具有相同值的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!