oracle - Fetching Column with table name alias is not working in VBA -
i trying connect oracle table through vba , fetching data. situation reference 1 table multiple times pivot. while running query via vba it's throwing error fetching data through table alias: below dummy code.
sub button1_click() dim strdatasource, strusername, strpassword, strconnectionstring, strquery string dim objadodbconnection, objadodbrecordset object strdatasource = "xxxx" strusername = "xxxx" strpassword = "xxxx" strconnectionstring = "provider=msdaora;data source=" & strdatasource & ";persist security info=true;password=" & strpassword & ";user id=" & strusername set objadodbconnection = createobject("adodb.connection") objadodbconnection.open strconnectionstring set objadodbrecordset = createobject("adodb.recordset") strquery = "select t1.column1 table1 t1 column2='xxxx' , column3='xxxx'" set objadodbrecordset = objadodbconnection.execute(strquery) msgbox objadodbrecordset.fields(0).value objadodbrecordset.close objadodbconnection.close set objadodbrecordset = nothing set objadodbconnection = nothing end sub
the same query running fine without table alias. please suggest!!
from table1 t1
you should remove 'as' in condition -
from table1 t1
Comments
Post a Comment