dreamevil0002 2016-10-06 12:04
浏览 42

查询结果重复

$query="Select distinct * from voucher_payment LEFT Join vouchers ON voucher_payment.voucher_id = vouchers.voucher_id LEFT JOIN payment_details ON voucher_payment.payment_id= payment_details.payment_id where paid_amount > 0";

$result = pg_query($conn,$query);

<th>File Name</th>
<th>Date Recieved</th>




</tr>
</thead>
<?php 

while($row = pg_fetch_array($result))
{
$servicedate=$row['service_dos']; 
$code= $row['cpt_code'];
$servicedate= substr($row['service_dos'],0,4) . "-". substr($row['service_dos'],4,2). "-". substr($row['service_dos'],6) ;

$query2="Select * from charge LEFT Join payment ON charge.charge_id = payment.charge_id where charge.cpt_code NOT LIKE '" .$code  . "' AND charge.charge_treatment_date != '" .$servicedate  . "'";
$result2 = pg_query($conn2,$query2); 
$row2= pg_fetch_array($result2);


?>

<tbody>


<tr>

<td><?php echo $row['file_name']; ?></td>
<td><?php echo $row['parsing_date']; ?></td>

The outcome are:

File name                Date
---------               --------
2943875897               2016-07-08
2943875897               2016-07-08
2943875897               2016-07-08
2943875897               2016-07-08

And so on, I put distinct but still the same results just different names, can anyone tell me what seems to be the issue? I also wanted to GROUP BY thinking it would help but it didn't.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用
    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
    • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
    • ¥15 帮我写一个c++工程
    • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
    • ¥15 关于smbclient 库的使用