i am using jdbc in my program with a query statement that retrieve holdingsID by querying different tables. when i run the program it has an error saying
Column HoldingsID in field list is ambiguous, what does this mean? How can i solve it?
here is my code, included is my sql select statement please check it.
String key=request.getParameter("key");
Connection conn = null;
String[][] a=new String[10][3];
int r=0;
String qstr="";
ResultSet rs=null;
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost/scitemp?user=scinetadmin&password=A1kl@taN");
Statement stmt=conn.createStatement();
qstr="SELECT DISTINCT HoldingsID FROM tblHoldings, tblHoldingsAuthorName," +
"tblHoldingsSubject, tblHoldingsPublisherName"+
" WHERE (tblHoldings.Title LIKE "+"'"+"%"+key+"%"+"'"+")"+" OR "+
"(tblHoldings.Contents LIKE "+"'"+"%"+key+"%"+"'"+")"+" OR " +
"(tblHoldingsAuthorName.AuthorName LIKE "+"'"+"%"+key+"%"+"'"+")"+" OR " +
"(tblHoldingsSubject.SubjectHeadings LIKE "+"'"+"%"+key+"%"+"'"+")"+" OR " +
"(tblHoldingsPublisherName.PublicationDate = "+"'"+key+"'"+")"+
" ORDER BY HoldingsID";
rs = stmt.executeQuery(qstr);
while ( rs.next() && r <10) {
a[r][0]=rs.getString("HoldingsID");
a[r][1]="1";
a[r][2]="SILMS";
r++;
}
}catch(Exception e){out.println("error:"+e.getMessage());}
-----
thanks in advance for your help