1
我有一系列的按日期劃分和命名的格式如下表日期的順序:生成用於在for循環
public.schedule_20121018
有沒有一種方法來生成日期在上面20121018
模式的順序,從而我可以做一個循環SELECT
到information_schema.tables
?
現在我已經得到了
SELECT * FROM information_schema.tables
WHERE table_type = 'BASE TABLE'
AND table_schema = 'public'
AND table_name like 'schedule_%'
ORDER BY table_name;
但是比如我需要的最後7天的記錄,這樣的日期順序應當從開始到20121012
20121018
。謝謝!
謝謝Clodoaldo。我嘗試過'to_char',但它給'ERROR:函數的多個小數點「to_char」'。你有沒有在你的機器上試過它,還是應該使用其他一些功能?我懷疑這是我使用較低的Postgresql版本8.2?謝謝! – Rock
@Rock增加了舊版postgresql版本的版本。 –
非常感謝Clodoaldo。我以另一種方式計算出它的結果:'select * fromge(*)'的日期,作爲s(a)選擇regexp_replace((current_date + sa),' - ','','g')''但你的更清潔。謝謝! – Rock