2016-11-10 71 views
0

我想有一個循環,最大時間10-10-2016和最小10-10-2016之間的圓和列'狀態'將值更改爲'我'。我的列名是「時間」,「bus_line」,「速度」,「日期使用循環時間變量

SELECT * from list 

where date='2016-10-10' and rate='101' and bud_id='1900' 
order by time 
for i in min(time)..max(time) loop 
if time'i'<time<time'i' + interval '2.6 minute' 
then state = 'i' 
raise notice 'i is %' , i; 
end loop; 
+0

times like 8:32:00 – aminbiabanaki

+2

你的問題不清楚。提供樣本數據 – Viki888

+0

是否與您的[上一個](https://stackoverflow.com/questions/40519845/use-the-function-for-in-pgadmin-for-time)或不同的問題相同?如果不正確,請刪除以前的內容,並編輯這個更詳細的解釋。 –

回答

0

自1970-01-01 00:00:00 UTC你可以施放時間值的秒數與extract(epoch from min(time))然後遍歷它們。