日期:2014-05-18 浏览次数:20651 次
SELECT Customer.*, TMPQZCUSTOMERTBL.PH, TMPQZCUSTOMERTBL.SEQ FROM Customer, FROM TMPQZCUSTOMERTBL WHERE CustomerDt.电话1 = TMPQZCUSTOMERTBL.CUSTOMER_TEL OR CustomerDt.电话2 = TMPQZCUSTOMERTBL.CUSTOMER_TEL OR CustomerDt.电话3 = TMPQZCUSTOMERTBL.CUSTOMER_TEL
------解决方案--------------------
SELECT a.*,b.PH,b.SEQ FROM Customer a inner join( SELECT DISTINCT CUSTOMER_TEL,PH,SEQ FROM TMPQZCUSTOMERTBL)b on a.电话1 = b.CUSTOMER_TEL OR a.电话2 = b.CUSTOMER_TEL OR a.电话3 = b.CUSTOMER_TEL
------解决方案--------------------
SELECT a.*,b.PH,b.SEQ
FROM Customer a inner join(
SELECT DISTINCT CUSTOMER_TEL,PH,SEQ FROM TMPQZCUSTOMERTBL)b
on a.电话1 = b.CUSTOMER_TEL OR a.电话2 = b.CUSTOMER_TEL OR a.电话3 = b.CUSTOMER_TEL
------解决方案--------------------
SELECT a.*,b.PH,b.SEQ FROM Customer a inner join( SELECT CUSTOMER_TEL,PH,SEQ FROM TMPQZCUSTOMERTBL GROUP BY CUSTOMER_TEL,PH,SEQ )b on a.电话1 = b.CUSTOMER_TEL OR a.电话2 = b.CUSTOMER_TEL OR a.电话3 = b.CUSTOMER_TEL