以下是两个表Vehicle
和vehicle_owner
VEHICLE_OWNER TABLE
**Oid Oname Oage Oaddress**
1 Ahsan 22 house 80/3 street no 22 rawalpindi
2 Arslan 23 House no 56-C F6/2 Islamabad
车辆表
**Vregno Vname Vmakername Vtype Vyear Vstatus V_oid**
FSM393 Mehran Suzuki Car 2006 Clear 1
RLA3725 City Honda Car 2013 Stolen 2
代码:
PreparedStatement p = conn.prepareStatement("select Vstatus,Oname from Vehicle_Owner LEFT OUTER JOIN Vehicle ON vehicle_owner.Oid= Vehicle.V_oid where Vregno='"+ss+"'");
ResultSet r=p.executeQuery();
while(r.next()) {
vstatus=r.getString("Vstatus");
oname=r.getString("Oname");
System.out.println("Vehicle Status= "+vstatus+"<br>");
System.out.println("Owner name= "+oname+"<br>");
}
我想在车辆登记号码上显示Oname和Vstatus。 (Vregno)我使用这个查询但它在MYSQL中不起作用
select Vstatus,Oname from Vehicle_Owner INNER JOIN Vehicle ON vehicle.V_oid= vehicle_owner.Oid AND Vregno="FSM393";
任何人请帮助我