java - Assigning variable to column with same name as another in a different table from JOIN -
i doing join retrieve data database , assigning variables
rs = select.executequery("select pk_task, pointperson, task.scrumid, story.scrumid, product.scrumid [task] " + "inner join [story] on storyid=pk_story inner join [product] on productid=pk_product product.deleted!=1");
to retrieve data:
while(rs.next()) { string taskid = rs.getstring("pk_task"); }
but how data columns have same name on different tables:
while(rs.next()) { long taskscrumid = rs.getlong("task.scrumid"); }
results in:
com.microsoft.sqlserver.jdbc.sqlserverexception: column name task.scrumid not valid.
either use getstring(int)
or use task.scrumid task_scrum_id
, getstring("task_scrum_id"). prefer latter approach.
so, in case, task be
string taskid = rs.getstring(3)
or query
select.executequery("select pk_task, pointperson, task.scrumid task_scrum_id, ... string taskid = rs.getstring("task_scrum_id")
Comments
Post a Comment