普通网友 2012-10-09 08:15
浏览 49

Aster db返回错误的行号

I am connected to Aster DB using PHP VIA ODBC. I am running a query which is taking a long time to run. I have added limit to get 1000 records only. While displaying those records, it prints exact 1000 records, but when I print total number of rows it displays a very large number (140393890971647).

Why is it returning wrong row nums while its printing 1000 only. I need to know exact number of rows as I have to break data in chunks to insert in PostgreSQL.

Here is my query for aster:

select new_ean as ean, com_email as email, ranking from (select new_ean, com_email, rank() over (partition by com_email order by new_ean) as ranking from (select distinct p1.ean as new_ean , c.com_email from bn.table1 p1 join bn.table2 pcm1 on p1.ean = pcm1.ean join bn.table2 pcm2 on pcm1.contributor_id = pcm2.contributor_id join bn.table1 p2 on pcm2.ean = p2.ean join bn.table3 coi on coi.ean = pcm2.ean and demand_dt > current_date-730 join bn.table4 c on coi.customer_sk = c.customer_sk where p1.ean in (long list of coma separated ean here) and p2.inc_category_code = p1.inc_category_code) sq1) sq2 where ranking <= 4 order by new_ean asc 
limit 1000 OFFSET 1

Here is my php code:

$rs = odbc_exec($aster, $sql);
 echo "Tot Rows :".odbc_num_rows($rs). " <br> ";

while ($row = odbc_fetch_row($rs))
    {

         echo "<br>" . odbc_result($rs,1) . "===" . odbc_result($rs,2) . "===" .odbc_result($rs,3);

    }
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 下图接收小电路,谁知道原理
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度