北理工招待所如何订:select语句怎么查询两个结构相同的表啊??

来源:百度文库 编辑:神马品牌网 时间:2024/05/13 15:47:29
<%
Class.forName
("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:product");
String productid=new String(request.getParameter("id").getBytes("8859_1"));
String selsql="select * from ////////// where productid='"+productid+"'";
Statement stmt=con.createStatement();
ResultSet rest=stmt.executeQuery(selsql);
if (rest.next())
{
%>

/////位置我想放2个表 怎么写啊!!!!!!!!!!!

select * from tableA where productid='"+productid+"'
union
select * from tableB where productid='"+productid+"'

select * from tableA a,tableB b where a.productid='"+productid+"' or b.productid='"+productid+"'