Hi Geek,
Thanks a lot for your reply, As mentioned earlier when I say I want to add the below sql statement to my existing one then I mean that I want to include that the below statement also to my existing one that is to create one sql statement by merging both of them.
Sql Statement which I want to merge / include in my existing statement :
Code:SELECT mydata.[Value In Object Currency] / Fxrates.[Exchange Rate] as Value In Euros FROM mydata INNER JOIN Fxrates ON mydata.Period = Fxrates.Period AND mydata.Year = Fxrates.Year AND mydata.[Object Currency] = Fxrates.[Object Currency]
My existing statement :
I have tried adding the new statement into my existing sql statement. I have also highlighted those lines in Red. Please help.. I have tried to include the new statement into existing one as per my requirement.Code:cmd1.CommandText = "SELECT mydata.*, CRM.Country, CCM.[Sub Product UBR Code], CEM.FSI_LINE3_code, mydata.[Value In Object Currency] / Fxrates.[Exchange Rate] as Value In Euros " _ & "FROM Data_SAP.dbo.mydata mydata " _ & "INNER JOIN Data_SAP.dbo.[Country_Region Mapping] CRM " _ & " ON (mydata.[Company Code] = CRM.[Company Code])" _ & "INNER JOIN Data_SAP.dbo.[Cost Center mapping] CCM " _ & " ON (mydata.[Cost Center] = CCM.[Cost Center])" _ & "INNER JOIN Data_SAP.dbo.[Cost Element Mapping] CEM " _ & " ON (mydata.[Unique Indentifier 1] = CEM.CE_SR_NO)" _ & " INNER JOIN Fxrates ON mydata.Period = Fxrates.Period AND" & " mydata.Year = Fxrates.Year AND mydata.[Object Currency] = Fxrates.[Object Currency]" & "WHERE CRM.Country IN (" & selection1 & ") " _ & " AND CCM.[Sub Product UBR Code] IN (" & selection & ") " _ & " AND CEM.FSI_LINE3_code IN (" & selection2 & ")" _ & " AND mydata.year = '" & ComboBox4.Value & "' " _ & " AND mydata.period = '" & ComboBox3.Value & "'" _ & " AND mydata.[Document Type]= '" & Left(ComboBox11.Value, 2) & "'
Thanks a lot for your help in advance.![]()




Reply With Quote