Home How convert rows to columns(SQL)?
Reply: 0

How convert rows to columns(SQL)?

user1078 Published in April 25, 2018, 12:13 pm

I want to do this: Desired Output

but I actually have this: Current Output

this is my sql code:

enter code here

SELECT `a`.`itemId` AS itemId, `a`.`donationId` AS `donationId`,
`a`.`typeId` AS `typeId`, `a`.`currencyId` AS `currencyId`,
`a`.memberId AS memberId, `a`.amount_total AS amount_total, a.ref AS
ref, a.ref_bank AS ref_bank, `a`.`hidden` AS `hidden`, a.code AS code,
concat( `b`.`first_name`, ' ', `b`.`last_name` ) AS member_name,
`c`.currencyCode AS currencyCode, `f`.`name` AS `payment_name`,
e.itemEnvelopId,    e.itemId AS itemIdP,    e.accountId,    e.amount,
e.hidden as envelopHidden,  g.NAME, g.new_number 
ai_donation_items `a` LEFT JOIN ai_church_members `b` ON a.memberId = b.memberId    
LEFT JOIN ai_currency `c` ON a.currencyId = c.currencyId    
LEFT JOIN ai_payment_types `f` ON a.typeId = f.typeId   
LEFT JOIN ai_donation_envelops_item as e on a.itemId = e.itemId 
LEFT JOIN ai_accounts AS g ON e.accountId = g.accountId  
WHERE `a`.`hidden` = 0 AND e.hidden = 0 and a.donationId = 1
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.357618 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO