Re: [SQL] First day of month, last day of month

2008-04-24 Thread Nacef LABIDI
It would be rather : test=*# select date_trunc('month', current_date), date_trunc('month', current_date)+'1month': > > :interval-'1sec'::interval; "2008-04-01 00:00:00+02";"2008-04-30 23:59:59+02" On Thu, Apr 24, 2008 at 3:15 PM, A. Kretschmer < [EMAIL PROTECTED]> wrote: > am Thu, dem 24.04.

Re: [SQL] extracting words

2008-04-24 Thread Tarlika Elisabeth Schmitz
On Wed, 23 Apr 2008 07:18:44 +0200 "A. Kretschmer" <[EMAIL PROTECTED]> wrote: > am Tue, dem 22.04.2008, um 22:25:04 +0100 mailte Tarlika Elisabeth > Schmitz folgendes: > > TABLE product: product_pk, product_name, department_fk > > TABLE product: department_pk, department_name > > > > ... > >

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Fernando Hevia
> -Mensaje original- > De: Scott Marlowe [mailto:[EMAIL PROTECTED] > > > Note that if you are storing your time stamp as timestamptz, > you can use the "at time zone 'xyz'" construct to create an > index, and as long as you retrieve them with the same > construct you'll get to use

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Scott Marlowe
On Thu, Apr 24, 2008 at 9:16 AM, Scott Marlowe <[EMAIL PROTECTED]> wrote: > On Thu, Apr 24, 2008 at 9:10 AM, Fernando Hevia <[EMAIL PROTECTED]> wrote: > > > De: [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED] En nombre de Scott Marlowe > > > > > > > > Then you can just use date_trunc on t

Re: [SQL] How I can check a substring is a valid number in postgresql ?

2008-04-24 Thread TJ O'Donnell
This regular expression works for numeric/float values as well as integers. It allows for exponents. tvalue ~ E'^[+-]?[0-9]+(.[0-9]*)?([Ee][+-]?[0-9]+)?\$' TJ O'Donnell http://www.gnova.com/ -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription:

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Scott Marlowe
On Thu, Apr 24, 2008 at 9:10 AM, Fernando Hevia <[EMAIL PROTECTED]> wrote: > > De: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] En nombre de Scott Marlowe > > > > > Then you can just use date_trunc on the values in the > > database. Plus if you're using timestamp WITHOUT timezone, > > you c

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Erik Jones
On Apr 24, 2008, at 9:56 AM, Scott Marlowe wrote: On Thu, Apr 24, 2008 at 8:52 AM, Terry Lee Tucker <[EMAIL PROTECTED] > wrote: On Thursday 24 April 2008 10:47, Bart Degryse wrote: Well, that's what it does afaikt. And what does afaikt mean? As Far As I Kan Tell? ??? I'm used to AFAIR

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Erik Jones
On Apr 24, 2008, at 9:52 AM, Terry Lee Tucker wrote: On Thursday 24 April 2008 10:47, Bart Degryse wrote: > Well, that's what it does afaikt. afaikt -> as far as I can tell. Erik Jones DBA | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Fernando Hevia
> -Mensaje original- > De: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] En nombre de Scott Marlowe > > Then you can just use date_trunc on the values in the > database. Plus if you're using timestamp WITHOUT timezone, > you can index on it. > Did not understand this. Are you sayin

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Bart Degryse
sory, afaikt vas djust a tiping eror. mi apollogys >>> "Scott Marlowe" <[EMAIL PROTECTED]> 2008-04-24 16:56 >>> On Thu, Apr 24, 2008 at 8:52 AM, Terry Lee Tucker <[EMAIL PROTECTED]> wrote: > > On Thursday 24 April 2008 10:47, Bart Degryse wrote: > > > Well, that's what it does afaikt. > > And what

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Scott Marlowe
On Thu, Apr 24, 2008 at 8:52 AM, Terry Lee Tucker <[EMAIL PROTECTED]> wrote: > > On Thursday 24 April 2008 10:47, Bart Degryse wrote: > > > Well, that's what it does afaikt. > > And what does afaikt mean? As Far As I Kan Tell? ??? I'm used to AFAIR, As Far As I Rekall... :) -- Sent via pgsql-s

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Scott Marlowe
On Thu, Apr 24, 2008 at 8:43 AM, Nacef LABIDI <[EMAIL PROTECTED]> wrote: > Actually I want to select all rows whith dates between first day of the > month 00:00:00 and last date of the month 23:59:59 Then you can just use date_trunc on the values in the database. Plus if you're using timestamp WIT

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Terry Lee Tucker
On Thursday 24 April 2008 10:47, Bart Degryse wrote: > Well, that's what it does afaikt. And what does afaikt mean? -- Terry Lee Tucker Turbo's IT Manager Turbo, division of Ozburn-Hessey Logistics 2251 Jesse Jewell Pkwy NE Gainesville, GA 30501 Tel: (336) 372-6812 Fax: (336) 372-6812 Cell: (3

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Bart Degryse
Well, that's what it does afaikt. >>> "Nacef LABIDI" <[EMAIL PROTECTED]> 2008-04-24 16:43 >>> Actually I want to select all rows whith dates between first day of the month 00:00:00 and last date of the month 23:59:59 On Thu, Apr 24, 2008 at 4:15 PM, Colin Wetherbee <[EMAIL PROTECTED]> wrote: F

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Nacef LABIDI
Actually I want to select all rows whith dates between first day of the month 00:00:00 and last date of the month 23:59:59 On Thu, Apr 24, 2008 at 4:15 PM, Colin Wetherbee <[EMAIL PROTECTED]> wrote: > Frank Bax wrote: > > > Frank Bax wrote: > > > > > Nacef LABIDI wrote: > > > > > > > is there a b

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Erik Jones
On Apr 24, 2008, at 9:15 AM, Colin Wetherbee wrote: Frank Bax wrote: Frank Bax wrote: Nacef LABIDI wrote: is there a better method to retrieve all the rows with dates in the current month. select * from mytable where extract(month from mydate) = extract(month from now()) and extract(yea

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Bart Degryse
Don't know whether it's better, but it's shorter. With extract you have to make the extraction for both year and month (unless cases where either one doesn't matter) With date_trunc('month', ...) you throw away anything smaller than month in one step. I suppose having to call the function date_tr

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Colin Wetherbee
Frank Bax wrote: Frank Bax wrote: Nacef LABIDI wrote: is there a better method to retrieve all the rows with dates in the current month. select * from mytable where extract(month from mydate) = extract(month from now()) and extract(year from mydate) = extract(year from now()); Sorry; I was

Re: [SQL] How I can check a substring is a valid number in postgresql ?

2008-04-24 Thread Volkan YAZICI
On Thu, 24 Apr 2008, "Anoop G" <[EMAIL PROTECTED]> writes: > How I can check a substring is a valid number in postgresql ? SELECT col ~ '[0-9]+'; Regards. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsq

[SQL] How I can check a substring is a valid number in postgresql ?

2008-04-24 Thread Anoop G
Dear All, How I can check a substring is a valid number in postgresql ? example: I have a query select max(substring(code,2,length(code))::INT) from emp where substring(code,0,2) = 'A'; code A0001 A0002 ABC005 S0002 This query fails because of ABC002, how I can avoid this erro

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Frank Bax
Frank Bax wrote: Nacef LABIDI wrote: is there a better method to retrieve all the rows with dates in the current month. select * from mytable where extract(month from mydate) = extract(month from now()) and extract(year from mydate) = extract(year from now()); Sorry; I was not thinking cl

Re: [SQL] First day of month, last day of month

2008-04-24 Thread A. Kretschmer
am Thu, dem 24.04.2008, um 14:59:47 +0200 mailte Nacef LABIDI folgendes: > Hi all, > > I want to select data from a table according to a date column in my table. I > want to select all the rows which have date in the current month. So is there > a > way to get from the actual date the first day

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Bart Degryse
select * from mytable where date_trunc('month', mydate) = date_trunc('month', now()); >>> Frank Bax <[EMAIL PROTECTED]> 2008-04-24 15:06 >>> Nacef LABIDI wrote: > is there a better method to retrieve all > the rows with dates in the current month. select * from mytable where extract(month fro

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Frank Bax
Nacef LABIDI wrote: is there a better method to retrieve all the rows with dates in the current month. select * from mytable where extract(month from mydate) = extract(month from now()) and extract(year from mydate) = extract(year from now()); -- Sent via pgsql-sql mailing list (pgsql-sql@p

[SQL] First day of month, last day of month

2008-04-24 Thread Nacef LABIDI
Hi all, I want to select data from a table according to a date column in my table. I want to select all the rows which have date in the current month. So is there a way to get from the actual date the first day and the last day of the month or is there a better method to retrieve all the rows with