MySQL子查詢

ywxj_001發表於2019-11-29

SELECT 

SUBSTRING(REPLACE(REPLACE(REPLACE(REPLACE(do,'B',''),'.','0'),'_','1'),'-','1'),1,32),B.id,B.du,B.phone,B.createdate,

B.modifydate FROM ca.pro  AS B

WHERE SUBSTRING(REPLACE(REPLACE(REPLACE(REPLACE(do,'B',''),'.','0'),'_','1'),'-','1'),1,32) IN 

(SELECT A.do1 FROM 

(SELECT SUBSTRING(REPLACE(REPLACE(REPLACE(REPLACE(do,'B',''),'.','0'),'_','1'),'-','1'),1,32) AS do1,COUNT(*) AS count1 FROM ca.pro

GROUP BY SUBSTRING(REPLACE(REPLACE(REPLACE(REPLACE(do,'B',''),'.','0'),'_','1'),'-','1'),1,32)

HAVING COUNT(*) >1) AS A)


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22996654/viewspace-2666306/,如需轉載,請註明出處,否則將追究法律責任。

相關文章