m0_37908418 2021-08-23 17:36 采纳率: 70.2%
浏览 51
已结题

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 只有几百条 不知什么问题

  • 写回答

3条回答 默认 最新

  • CSDN专家-showbo 2023-03-09 16:17
    关注

    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.
    来源:

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 3月17日
  • 已采纳回答 3月9日
  • 创建了问题 8月23日

悬赏问题

  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?