pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedhow to select a time frame on timestamp rows.
3+ messages / 2 participants
[nested] [flat]
* how to select a time frame on timestamp rows.
@ 2001-01-14 00:24 bartschm@psi.com
0 siblings, 1 reply; 3+ messages in thread
From: bartschm@psi.com @ 2001-01-14 00:24 UTC (permalink / raw)
To: pgsql-sql
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!
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: how to select a time frame on timestamp rows.
@ 2001-01-14 01:10 Peter Eisentraut <peter_e@gmx.net>
parent: bartschm@psi.com
0 siblings, 1 reply; 3+ messages in thread
From: Peter Eisentraut @ 2001-01-14 01:10 UTC (permalink / raw)
To: bartschm@psi.com; +Cc: pgsql-sql
bartschm@psi.com 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 peter_e@gmx.net http://yi.org/peter-e/
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: how to select a time frame on timestamp rows.
@ 2001-01-14 01:40 bartschm@psi.com
parent: Peter Eisentraut <peter_e@gmx.net>
0 siblings, 0 replies; 3+ messages in thread
From: bartschm@psi.com @ 2001-01-14 01:40 UTC (permalink / raw)
To: pgsql-sql
Peter Eisentraut wrote:
Thanks Peter for the answer, so i assume i can also do
select user_name from tbacct where extract(month from acct_timestamp) =
11 and extract(year from acct_timestamp) = 2000 ...
>
> bartschm@psi.com 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 peter_e@gmx.net http://yi.org/peter-e/
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2001-01-14 01:40 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-01-14 00:24 how to select a time frame on timestamp rows. bartschm@psi.com
2001-01-14 01:10 ` Peter Eisentraut <peter_e@gmx.net>
2001-01-14 01:40 ` bartschm@psi.com
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox