Select 客F.客GID , 客F.客CD , 客F.名前 , 履歴V.最終日付 , 履歴V.伝票担当CD FROM 客F LEFT OUTER JOIN ( SELECT * FROM ビュー表 WHERE ( 客CD >=1 AND 客CD <=999999999) ) AS 履歴V ON 客F.客GID = 履歴V.客GID AND 客F.客CD = 履歴V.客CD AND 客F.店ID = 履歴V.店ID --WHERE 客F.客CD >=1 and 客F.客CD <=10000 WHERE 履歴V.伝票担当CD >=1 and 履歴V.伝票担当CD <=10