公司–)SQL框架内部用
SELECT
TOP [onePageDataNumber] CN_ID AS primaryId,
CN_NAME AS name,
CN_NO AS no
FROM
(
SELECT
CN_ID,
CN_NAME,
CN_NO
FROM
TN_DEPARTMENT
UNION
SELECT
CN_ID,
CN_NAME,
CN_NO
FROM
TN_VEND_TABLE
) AS DANDV
WHERE
CN_ID NOT IN (
SELECT
TOP [maxRowNumber] CN_ID
FROM
(
SELECT
CN_ID,
CN_NAME,
CN_NO
FROM
TN_DEPARTMENT
UNION
SELECT
CN_ID,
CN_NAME,
CN_NO
FROM
TN_VEND_TABLE
) AS DANDV
WHERE
(
# DANDV.CN_NO LIKE '%[no]%'
AND # DANDV.CN_NAME LIKE '%[name]%'
AND #DANDV.CN_ID = [primaryId]
)
ORDER BY
CN_ID ASC
)
AND (
# DANDV.CN_NO LIKE '%[no]%'
AND # DANDV.CN_NAME LIKE '%[name]%'
AND #DANDV.CN_ID = [primaryId]
)
ORDER BY
CN_ID ASC