2013-03-05 55 views
0

現在我有兩個領域:更換時間格式CONCAT SQL

MEETING_TIME_START | MEETING_TIME_END 
--------------------+-------------------- 
9:30:00.000000AM | 10:50:00.000000AM 
11:00:00.000000AM | 12:20:00.000000PM 
11:00:00.000000AM | 12:20:00.000000PM 
10:00:00.000000AM | 10:50:00.000000AM 

我有一個標準來創建一個新的領域,並重新格式化時間:

(SUBSTR((D.MEETING_TIME_START),1,5)%concat '- ' %concat SUBSTR((D.MEETING_TIME_END),1,5)) 

這導致與以下:

NEW FIELD 
------------ 
09.30- 10.50 
11.00- 12.20 
11.00- 12.20 
10.00- 10.50 

如何調整我的標準來創建此格式:

PREFERRED OUTPUT 
---------------- 
0930-1050 
1100-1220 
1100-1220 
1000-1050 

回答

0

你能試試嗎?

(SUBSTR((D.MEETING_TIME_START),1,2) || SUBSTR((D.MEETING_TIME_START),4,2) || '-' || SUBSTR((D.MEETING_TIME_END),1,2) || SUBSTR((D.MEETING_TIME_START),4,2))

0

如果它是MySQL的我會嘗試這樣的:

CONCAT(SUBSTR(D.MEETING_TIME_START,1,2),SUBSTR(D.MEETING_TIME_START,4,2),'-',SUBSTR(D.MEETING_TIME_END,1,2), SUBSTR(D.MEETING_TIME_END,4,2))