python 应用sql 文件 查出的数据只有800条,但这个sql 在数据库查询有5w 条

怎样处理这种问题,网上查说可以分批 查 但无详细说明,是什么原因同一个sql 语句放入python 执行就得不到全部数据?
请提出详细方案 可给全部奖赏哦

select sh_code,cast(trx_date as date) opendate,cashi_no,trx_type, count(trx_no) cunt from trx_hdr group by cast(trx_date as date),sh_code,cashi_no,trx_type having cast (trx_date as date) >='2021-01-01' order by sh_code"

where substring(cashi_no,5,2) in ('21','22') and cashi_no like('____21%') or cashi_no like('____22%') group by cast(trx_date as date),sh_code,cashi_no,trx_type having cast (trx_date as date) >='2021-01-01' order by sh_code
我在sql server 执行有几万条记录,放到python 只有几百条 不知什么问题

1

I sort of figured out the problem. It was silly at the end. It was a race condition!

This is how my actual code was organized :

Code Block 1
{code which calls an API which creates an entry in Accounts table &
Creates corresponding entries in Product table(10 entries)}
......

Code Block2
{The code I had posted in my question}
The problem was that the API(called in Code Block 1) took a few seconds to add 10 entries into the Product table.
来源:

几百条你是怎么统计出来的,控制台输出有范围限制。
你把查询的结果改为select count(1) from ....看看返回的记录条数是多少。

您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632