MySQL Forums
Forum List  »  Newbie

crosstab
Posted by: maetrox kulon
Date: November 26, 2015 04:49AM

Hello, this is about code below :-

select year(my.invoiceDate) as year, C2.company,

(select sum(case when
isGST ='GST' then (total * 0.06) + total
else total end)
from trn_Invoice I
left join trn_Invoice_sub InvSub on I.invoiceNo=InvSub.invoiceNo
join mtr_charges Charge on InvSub.chargesId=Charge.chargesId
where year(I.invoiceDate)='2014' and month(I.invoiceDate)='3') as 'MAR',

(select sum(case when
isGST ='GST' then (total * 0.06) + total
else total end)
from trn_Invoice I
left join trn_Invoice_sub InvSub on I.invoiceNo=InvSub.invoiceNo
join mtr_charges Charge on InvSub.chargesId=Charge.chargesId
where year(I.invoiceDate)='2014' and month(I.invoiceDate)='4') as 'APR'

from trn_Invoice my
join mtr_customer C2 on my.ROCNo=C2.ROCNo
where year(my.invoiceDate)='2014' and my.status = '1'
group by my.ROCNo;
=============================================code_end============

...although the result is different for that two column BUT the result give me same value at each row of company,

HOW to make it related to company in each row? Please anyone can help....

Options: ReplyQuote


Subject
Written By
Posted
crosstab
November 26, 2015 04:49AM
December 21, 2015 08:04PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.