我可以 运行 对每一行进行单独的查询,而不是使用单个查询打印所有数据吗?

Can I run a separate query on each row instead of printing all the data with a single query?

$query = mysqli_query($conn,SELECT `date`,`name`,`surname`, COUNT(*) AS abc FROM `trial` WHERE `name`='asd' GROUP BY `date`,`name`,`surname` ORDER BY `date` DESC);

<?php while ($row = mysqli_fetch_array($query)) : ?>
     <td><?php echo $row['abc']; ?></td>
     <td><?php echo $row['Can I print a value returned from a different query, not abc? ']; ?></td>

 <?php endwhile; ?>

我可以 运行 单独查询第二行吗?

将它们合并到一个查询中,获取每个姓氏的两个计数。

<?php
$query = mysqli_query($conn,"
    SELECT `date`,`surname`, SUM(name = 'asd') AS asd_count, SUM(name = 'opr') AS opr_count
    FROM `trial` 
    WHERE `name`= IN ('asd', 'opr')
    GROUP BY `date`,`surname`
    ORDER BY `date` DESC");
$result = mysqli_query($conn, $query);
while ($row = mysqli_fetch_assoc($result)): ?>
     <tr>
     <td><?php echo $row['date']; ?></td>
     <td><?php echo $row['surname']; ?></td>
     <td><?php echo $row['asd_count']; ?></td>
     <td><?php echo $row['opr_count']; ?></td>
     </tr>
<?php endwhile; ?>

multiple query same table but in different columns mysql

您还需要为查询返回的每一行开始一个新的<tr>