2017-07-22 32 views

回答

0

您可能只需要此查詢。

Select no_reg, location from activities where status = 0 

檢查結果並運行另一個查詢。

if (result == null){ //for example run the query below 

Select no_reg, location from activities desc limit 1 

} 
0

從你想要的圖像是設備的活動,我相信

例如,如果你想檢查設備A1馬來西亞應該是列表或一個具有最大的狀態將列爲我相信

如果這是你想要的這裏是

SELECT no_reg,MAX(status) FROM activities a,equipment e on e.no_reg=a.no_reg where e.no_reg='A1' group by a.no_reg 

我相信這是你期望

解決方案