删除或隐藏多余的行详细信息php mysql

时间:2017-10-12 08:25:14

标签: php mysql duplicates

我的查询

$q = SELECT f.voucher_number as 'voucher_number'
    ,f.transaction_id as 'transaction_id'
    ,f.payee_name as 'payee_name' 
    ,t.atc_code as 'atc_code'
    ,d.`details` as 'account_details'
    FROM `forsending` f
    LEFT JOIN 
    `transact` t
    ON f.transaction_id = t.t_id
    LEFT JOIN 
    `details` d
    ON d.d_id = f.transaction_id
    and t.atc_code = d.atc_code

结果在这里:

PDMK178482  TOYOTA NORTH    MK-GF-5406  UNION BANK CASA VALERO
PDMK178482  TOYOTA NORTH    MK-GF-7202  CLAIMS & LOSSES-DIR.BUS-MOTOR CAR-PC 
PDMK178482  TOYOTA NORTH    MK-GF-5312  INPUT VAT
PDMK178482  TOYOTA NORTH    MK-GF-3505  EXPANDED W/HOLDING TAX PAYABLE

PDMK178395  ELBRUS MOTOR    MK-GF-5406  UNION BANK CASA
PDMK178395  ELBRUS MOTOR    MK-GF-7202  CLAIMS & LOSSES-DIR.BUS-MOTOR CAR-PC
PDMK178395  ELBRUS MOTOR    MK-GF-5312  INPUT VAT
PDMK178395  ELBRUS MOTOR    MK-GF-3505  EXPANDED W/HOLDING TAX PAYABLE

但我希望我的代码看起来像这样:其中重复不必要的细节是隐藏或删除

PDMK178482  TOYOTA NORTH    MK-GF-5406  UNION BANK CASA VALERO
                            MK-GF-7202  CLAIMS & LOSSES-DIR.BUS-MOTOR CAR-PC
                            MK-GF-5312  INPUT VAT
                            MK-GF-3505  EXPANDED W/HOLDING TAX PAYABLE

PDMK178395  ELBRUS MOTOR    MK-GF-5406  UNION BANK CASA VALERO
                            MK-GF-7202  CLAIMS & LOSSES-DIR.BUS-MOTOR CAR-PC
                            MK-GF-5312  INPUT VAT
                            MK-GF-3505  EXPANDED W/HOLDING TAX PAYABLE

问候

0 个答案:

没有答案