シートカバー用品
SQL
SELECT * , GRP.URLNAME AS GRPURLNAME FROM M_SHOHINGRP GRP LEFT OUTER JOIN M_JYOKEN JYO ON JYO.GRPCODE = GRP.GRPCODE LEFT OUTER JOIN M_BRAND BRA ON BRA.BRACODE = GRP.BRACODE LEFT OUTER JOIN M_ECHIN ECH ON ECH.GRPCODE = GRP.GRPCODE LEFT OUTER JOIN ( SELECT GRPCODE, COUNT(HINCODE) AS COUNTS FROM M_HIN WHERE ECTORIFLG = 1 AND HINTEISHI IS NULL GROUP BY GRPCODE ) CNT ON CNT.GRPCODE = GRP.GRPCODE WHERE GRP.HYOJIFLG = 1 AND (( BNRCODE=1 AND CBNRCODE=12) OR ( BNRCODE=3 AND CBNRCODE=8) OR ( BNRCODE=4 AND CBNRCODE=9) ) AND NOT COALESCE( CNT.COUNTS, '0') = 0 ORDER BY GRP.SORTORDER DESC, GRP.GRPNAME