这是我对计数值及其计数的查询
echo $getq2 = "SELECT publisher,COUNT(publisher) from (select publisher from wiley where $getq2_ UNION ALL SELECT publisher FROM elsevier WHERE $getq2_ UNION ALL SELECT publisher FROM sage WHERE $getq2_ UNION ALL SELECT publisher FROM indianjournal WHERE $getq2_) as publisher Group by publisher order by publisher";
$getquery1 = $conn->query($getq2);
after the query fetching through
while($runrows =mysqli_fetch_object($getquery1))
{
print_r($getquery1);
echo $pub=$runrows->publisher;
//getting the publisher list
echo $count=$runrows->count['publisher'];
//not grtting the publisher count
}
我找到了出版商,但不是伯爵。我该如何计算? 结果是正确的
答案 0 :(得分:0)
将查询更改为这样。
echo $getq2 = "SELECT publisher,COUNT(publisher) as publisherCount from (select publisher from wiley where $getq2_ UNION ALL SELECT publisher FROM elsevier WHERE $getq2_ UNION ALL SELECT publisher FROM sage WHERE $getq2_ UNION ALL SELECT publisher FROM indianjournal WHERE $getq2_) as publisher Group by publisher order by publisher";
并使用echo $pub=$runrows->publisherCount
获取发布商数量
答案 1 :(得分:0)
echo $ getq2 =“SELECT发布者,COUNT(发布者)as pub from(从wiley选择发布者,其中$ getq2_ UNION ALL SELECT发布者FROM elsevier WHERE $ getq2_ UNION ALL SELECT发布者FROM sage WHERE $ getq2_ UNION ALL SELECT发布者FROM indianjournal WHERE $ getq2_)作为发布者组按出版商的出版商订单“; 查询shuld是这样的 echo $ pub = $ runrows-> pub