Hi All,
Actually I am very bad at sql statements so I need the help on the below.
Following is the sql statement which I have currently in my excel macro. I need your help to consolidate the following code into my existing statement which is as below :
And following is the sql statement which I want to add to the above statement :Code:cmd1.CommandText = "SELECT mydata.*, CRM.Country, CCM.[Sub Product UBR Code], CEM.FSI_LINE3_code 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)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) & "'
Code:SELECT mydata.[Value In Object Currency] * Fxrates.[Exchange Rate] as PriceInEuro FROM mydata INNER JOIN Fxrates ON mydata.Period = Fxrates.Period AND mydata.Year = Fxrates.Year AND mydata.[Object Currency] = Fxrates.[Object Currency]
Thanks a lot for your help in advance.![]()




Reply With Quote