所以我尝试使用1个程序来搜索所有返回所有col的搜索并使用关键工作进行搜索,以便在表中返回1个col并按页分组。通过关键工作使用搜索的东西在期望的col中返回了许多重复的结果。我正在尝试将行号分配给选择表,以不同的方式基于关键工作的条件作为稍后进行过滤的关键但它不起作用。
SELECT
*
FROM
(
SELECT
TOTALRECORD,
nRow,
PRODUCTID,
PRODUCTNAME,
STOREID,
STORENAME,
ROW_NUMBER() OVER (PARTITION BY nRow ORDER BY MASTERDATA.PM_PRODUCT_STOCKLIMIT.PRODUCTID) filter
FROM
(
SELECT
NVL2(v_txtSearch,ROW_NUMBER() OVER(ORDER BY MASTERDATA.PM_PRODUCT_STOCKLIMIT.STOREID) AS nRow,ROW_NUMBER() OVER(ORDER BY MASTERDATA.PM_PRODUCT_STOCKLIMIT.PRODUCTID) AS nRow),
COUNT(*) OVER() TOTALRECORD,...
))
WHERE
(nRow BETWEEN (t_PageNum * v_RecNum) AND ((t_PageNum + 1) * v_RecNum -1) or v_PageNum=0)
AND filter = 1
那么你如何实现呢?或者我应该尝试另一种方法?我也尝试过case if和else但是它可能有错误的语法或者不能在select O_O
中使用我尝试做类似
的事情 If v_keywork = null just make normal row number no partition and return
normal product/ store relationship order by store id
Filter - nROW - PRODUCTID - StoreID
1 | 1 | a | 1
1 | 2 | b | 1
1 | 3 | a | 2
1 | 4 | b | 3
If v_keywork != null partion by product id so later i use that filter to remove
duplicate product ID for searching product that have been stored in specific stores order by productID
Filter - nROW - PRODUCTID - StoreID
1 | 1 | a | 1
2 | 2 | a | 2
1 | 3 | b | 1
2 | 4 | b | 3