sql多字段模糊查询

SELECT FPT.PRODUCT_IMAGE_PATH AS PRODUCT_IMAGE_PATH,
FIM.ITEM_NAME AS ITEM_NAME,
FIM.ITEM_NUMBER AS ITEM_NUMBER,
FIM.SELF_ITEM_CODE AS SELF_ITEM_CODE,
FBIT.PIECE_JANCODE AS PIECE_JANCODE,
FBIT.SPEC_NAME AS SPEC_NAME,
FBIT.SPEC_BEGIN AS SPEC_BEGIN,
TO_CHAR(REPLACE((SELECT WMSYS.WM_CONCAT(IF_KIKAKU.MATCHING_M.MATCH_USER_NAME)
FROM IF_KIKAKU.FREE_ITEM_M INNER JOIN IF_KIKAKU.FREE_USER_M
ON IF_KIKAKU.FREE_USER_M.USER_CD = IF_KIKAKU.FREE_ITEM_M.USER_CD INNER JOIN
IF_KIKAKU.MATCHING_M ON IF_KIKAKU.MATCHING_M.SEQ = IF_KIKAKU.FREE_USER_M.FREE_FLG_OWNER_SEQ
AND IF_KIKAKU.MATCHING_M.USER_CD = '8002'
WHERE IF_KIKAKU.FREE_ITEM_M.ITEM_NUMBER = FIM.ITEM_NUMBER
AND (TO_CHAR(IF_KIKAKU.FREE_ITEM_M.DELETION_DATE, 'yyyy/mm/dd') =
'1900/01/01'
OR IF_KIKAKU.FREE_ITEM_M.DELETION_DATE IS NULL)
AND IF_KIKAKU.MATCHING_M.DEL_FLG = '0'
AND IF_KIKAKU.FREE_ITEM_M.USER_CD NOT IN (SELECT IF_KIKAKU.FREE_USER_M.USER_CD
FROM IF_KIKAKU.FREE_USER_M
WHERE IF_KIKAKU.FREE_USER_M.FREE_FLG_OWNER_SEQ = 24637)), ',', '、')) AS
OTHER_USER_NAME,
REPLACE((SELECT TO_CHAR(WMSYS.WM_CONCAT(PCT.PRODUCT_SELLER_NAME))
FROM IF_KIKAKU.PRODUCT_CUSTOMER_T PCT
WHERE PCT.USER_CD = FIM.USER_CD
AND PCT.SELL_PRODUCT_CD = FIM.SELF_ITEM_CODE
AND PCT.DEL_FLG = '0'
AND PCT.PRODUCT_SELLER_CODE IN (SELECT PRODUCT_SELLER_CODE
FROM IF_KIKAKU.ITEM_MATCHING_T
WHERE SELL_PRODUCT_CD = FIM.SELF_ITEM_CODE
AND SPECIFICATION_CD = FIM.ITEM_NUMBER)), ',', '、') AS PRODUCT_SELLER_NAME,
FIM.MEMO AS MEMO,
FIM.ITEM_KBN AS ITEM_KBN
FROM IF_KIKAKU.FREE_ITEM_M FIM LEFT JOIN IF_KIKAKU.FREE_BASIC_INFORMATION_T
FBIT
ON FBIT.USER_CD = FIM.USER_CD
AND FBIT.ITEM_NUMBER = FIM.ITEM_NUMBER LEFT JOIN IF_KIKAKU.FREE_PACKING_T FPT
ON FPT.USER_CD = FIM.USER_CD
AND FPT.ITEM_NUMBER = FIM.ITEM_NUMBER
AND (FPT.DEL_DATE = '1900/01/01'
OR FPT.DEL_DATE IS NULL)
WHERE FIM.USER_CD = '8002'
AND (FIM.DELETION_DATE = '1900/01/01'
OR FIM.DELETION_DATE IS NULL)
AND (FIM.ITEM_NAME LIKE ('%3329AB0D%')
OR FIM.ITEM_NUMBER LIKE ('%3329AB0D%')
OR FIM.SELF_ITEM_CODE LIKE ('%3329AB0D%')
OR FBIT.PIECE_JANCODE LIKE ('%3329AB0D%')
OR (REPLACE((SELECT TO_CHAR(WMSYS.WM_CONCAT(MATCH_USER_NAME))
FROM IF_KIKAKU.MATCHING_M INNER JOIN IF_KIKAKU.FREE_USER_M
ON IF_KIKAKU.FREE_USER_M.FREE_FLG_OWNER_SEQ = IF_KIKAKU.MATCHING_M.SEQ
INNER JOIN IF_KIKAKU.FREE_ITEM_M ON IF_KIKAKU.FREE_ITEM_M.USER_CD =
IF_KIKAKU.FREE_USER_M.USER_CD
AND (IF_KIKAKU.FREE_ITEM_M.DELETION_DATE = '1900/01/01'
OR IF_KIKAKU.FREE_ITEM_M.DELETION_DATE IS NULL)
WHERE IF_KIKAKU.FREE_ITEM_M.ITEM_NUMBER = FIM.ITEM_NUMBER
AND (IF_KIKAKU.FREE_ITEM_M.DELETION_DATE = '1900/01/01'
OR IF_KIKAKU.FREE_ITEM_M.DELETION_DATE IS NULL)
AND IF_KIKAKU.MATCHING_M.DEL_FLG = 0), ',', '、')) LIKE ('%3329AB0D%'))
ORDER BY FIM.SELF_ITEM_CODE DESC;

你可能感兴趣的:(模糊查询)