Re: [SQL] explicit casts

2011-01-05 Thread Adrian Klaver
On Wednesday 05 January 2011 5:22:30 pm Iuri Sampaio wrote: > So far, > I could write the following query > > select to_char(trunc(to_date('2010-01-02', '-mm-dd'), 'Month'), > 'fmMonth') as month, > to_char(trunc(to_date('2010-01-02', '-mm-dd'), 'Month'), '') as > year, > to_char(trunc(

Re: [SQL] explicit casts

2011-01-05 Thread Adrian Klaver
On Wednesday 05 January 2011 4:24:34 pm Iuri Sampaio wrote: > Hi there, > > I installed postgresql 8.4 on my box and now i have troubles with the > following query regarding explicit casts. > > select to_char(trunc(to_date(:the_date, '-mm-dd'), 'Month'), > 'fmMonth') as month, > to_char(tr

Re: [SQL] explicit casts

2011-01-05 Thread Iuri Sampaio
So far, I could write the following query select to_char(trunc(to_date('2010-01-02', '-mm-dd'), 'Month'), 'fmMonth') as month, to_char(trunc(to_date('2010-01-02', '-mm-dd'), 'Month'), '') as year, to_char(trunc(to_date('2010-01-02', '-mm-dd'), 'Month'), 'J') as first_julian_dat

[SQL] explicit casts

2011-01-05 Thread Iuri Sampaio
Hi there, I installed postgresql 8.4 on my box and now i have troubles with the following query regarding explicit casts. select to_char(trunc(to_date(:the_date, '-mm-dd'), 'Month'), 'fmMonth') as month, to_char(trunc(to_date(:the_date, '-mm-dd'), 'Month'), '') as year, t

Re: [SQL] foreign key question

2011-01-05 Thread Jasen Betts
On 2011-01-05, Gary Stainburn wrote: > On Wednesday 05 January 2011 09:53:43 Gary Stainburn wrote: >> Now I want to set up a new access level table specific to the itinerary, >> along the lines of >> >> u_id int4 not null references users(u_id) >> fl_level int4 not null references facility_levels(

Re: [SQL] foreign key question

2011-01-05 Thread Gary Stainburn
On Wednesday 05 January 2011 09:53:43 Gary Stainburn wrote: > Now I want to set up a new access level table specific to the itinerary, > along the lines of > > u_id int4 not null references users(u_id) > fl_level int4 not null references facility_levels(16, fl_level) > > Firstly, is this possible,

[SQL] foreign key question

2011-01-05 Thread Gary Stainburn
Hi folks, I have a table which lists facilities and another table that lists access levels for those facilities. All straight forward using a foreign key set up using a normal references clause. users=# select f_id, f_desc from facilities order by f_id; f_id | f_desc