列id (PK)、tid (FK)、lid(FK)、およびを含むテーブルがありますstatus (Varchar)。それぞれtidに複数lidあり、それぞれlidにstatus「完了」または「進行中」があります。
各 のステータスを取得したいのですがtid、tidのステータスは次のとおりです。すべてlidのステータスが「終了」のtid場合、tidステータスは「終了」になり、いずれかのlidステータスが「進行中」の場合、tidステータスは「進行中」になります。
これまでに行ったことは次のとおりです。
st2=con.createStatement();
String QueryString2 = "SELECT status from lo_status where topic_id='"+topicid+"'";
rs2 = st2.executeQuery(QueryString2);
while (rs2.next()) {
status=rs2.getString(1);
}
if(status == null){
status="Pending";
}
else if(status.equals("Finished")){
status="Finished";
}else{
status="Ongoing";
}