[SQL] how to select a time frame on timestamp rows.

2001-01-13 Thread bartschm

Hello,
today i was trying to perform a query on a database using a time stamp
field, i need to get all records which belong to year 2000, month 11,
is there any other way to doit, or is this the pgsql way?  , actually
i'm using a query like this:
select User_Name from tbacct where acct_timestamp like '2000-11%' group
by User_Name;

on MySQL i use this

select User_Name from tbAcct where month (Acct_Timestamp) = 11 group by
User_Name;
(on mysql i was't worried about year yet)

is anything like the month function from mysql on pg-sql? sorry if the
question
is to obvious, but i was reading the docs and can't find an answer.

Regards!



Re: [SQL] how to select a time frame on timestamp rows.

2001-01-13 Thread Peter Eisentraut

[EMAIL PROTECTED] writes:

   today i was trying to perform a query on a database using a time stamp
 field, i need to get all records which belong to year 2000, month 11,
 is there any other way to doit, or is this the pgsql way?  , actually
 i'm using a query like this:
 select User_Name from tbacct where acct_timestamp like '2000-11%' group
 by User_Name;

select user_name from tbacct where extract(month from acct_timestamp) = 11 ...

(SQL compliant)

-- 
Peter Eisentraut  [EMAIL PROTECTED]   http://yi.org/peter-e/