apache / apache/shardingsphere
SQLSERVER Page query field return error
- Dominant language
- Java
- Stars
- 20.8k
- Forks
- 6.9k
- Avg merge
- 11h 38m
- Merged PRs (30d)
- 326
Description
The sql server paging sql I use is as follows:
_select * from ( select TOP 30 ROW_NUMBER() OVER(ORDER BY P.BIZDATE DESC ) AS rownum, P.* FROM (select * from (
select
tao.dealType,
tao.orderNo,
tao.SourceNo,...
from TradeApi_Order tao
) f ) P ) as temp where temp.rownum > 0 ORDER BY temp.rownum_
The result field of the sql query is:
top(index:1), dealType(index:2) ,orderNo(index:3), SourceNo(index4)
However, the dealType index of shardingsphere record is as follows:

He seems to have skipped the index of the top field。
This causes all obtained field indexes to be reduced by 1.
version: 5.1.2
Contributor guide
Research direction
Start by reproducing the reported SQL Server paging query against ShardingSphere 5.1.2 and inspect how the result fields are indexed. Compare the returned positions for TOP, dealType, orderNo, and SourceNo; the issue is done when the field indexes match the SQL result order.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100