I have two tables, arrc_PurchActivity and arrc_Voucher. The purchase activity table contains multiple records per purchase, tied together by the credit card authorization. I need to return a single row per purchase, plus pull in a field from the voucher table. If I just grab a few fields from the purchase activity table, like this:
SELECT group_concat( VoucherID ) , CcAuthCode FROM arrc_PurchaseActivity GROUP BY CcAuthCode
it works fine, returning something like this:
group_concat( VoucherID ) | CcAuthCode
=========================================
610643,611139,610642 | 8LUPDN
What I need to do is pull in another contatenated field (VoucherNbr), this time from the arrc_Voucher table, where the voucher table's VoucherID is equal to the purchase table's VoucherID. In this case, because VoucherID is a concatenation, I need to return a concatenated column of VoucherNbr for each VoucherID in the concatenated column. Clear as mud, right? What I need would look like this:
group_concat( VoucherID ) | group_concat( VoucherNbr) | CcAuthCode
===========================|============================|=============
610643,611139,610642 | 123,456,789 | 8LUPDN
In other words, the VoucherNbr for VoucherID 610643 is 123, VoucherNbr for 611139 is 456, etc.
Can anyone help me out? This is way over my head...