![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi! I'm new to postgres and want to do something like select substring('MTWTFSS', from (Extract (dow from current_date)), for 1) I can't get the parser to accept anything I try. |
#3
| |||
| |||
|
| danfan46 wrote on 18.06.2010 22:52: Hi! I'm new to postgres and want to do something like select substring('MTWTFSS', from (Extract (dow from current_date)), for 1) I can't get the parser to accept anything I try. What are you trying to do? In Db2 I would express it like this: |
#4
| |||
| |||
|
|
I want to find those rows that has an F in days in position 5 if current date is a friday and a J in months position 6 if current month is June. If not so the job is not eligible for scheduling. This is a non normalized approach of course. :-) /dg |

|
select substring('MTWTFSS', from (Extract (dow from current_date)), for 1) |
#5
| |||
| |||
|
|
select substring('MTWTFSS', from (Extract (dow from current_date)), for 1) If you check the manual you'll see that the comma is incorrect to separate the parameters |
#6
| |||
| |||
|
|
On Fri, 18 Jun 2010 23:46:05 +0200, Thomas Kellerer wrote: select substring('MTWTFSS', from (Extract (dow from current_date)), for 1) If you check the manual you'll see that the comma is incorrect to separate the parameters Actually, that can be done with the commas, too: mgogala=# select substring('MTWTFSS',extract(dow from current_date)::integer,1); substring ----------- F (1 row) Time: 0.315 ms mgogala=# Thanks a lot! |
![]() |
| Thread Tools | |
| Display Modes | |
| |