Aster db返回错误的行号

时间:2012-10-09 08:15:41

标签: php odbc teradata-aster

我使用PHP VIA ODBC连接到Aster DB。我正在运行一个需要很长时间才能运行的查询。我添加了限制只能获得1000条记录。显示这些记录时,它会打印1000条记录,但是当我打印总行数时,它会显示一个非常大的数字(140393890971647)。

为什么在仅打印1000时返回错误的行num。我需要知道确切的行数,因为我必须在块中打破数据以插入PostgreSQL。

以下是我对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

这是我的php代码:

$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 个答案:

没有答案