pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedGROUP by finish&&last day of month
4+ messages / 4 participants
[nested] [flat]
* GROUP by finish&&last day of month
@ 2000-07-05 12:32 Antti Linno <alligator@all.ee>
2000-07-05 12:46 ` Re: GROUP by finish&&last day of month Jerome Alet <alet@unice.fr>
2000-07-05 13:00 ` Re: GROUP by finish&&last day of month tjk@tksoft.com <tjk@tksoft.com>
2000-07-05 15:00 ` Re: GROUP by finish&&last day of month Patrick Jacquot <patrick.jacquot@anpe.fr>
0 siblings, 3 replies; 4+ messages in thread
From: Antti Linno @ 2000-07-05 12:32 UTC (permalink / raw)
To: pgsql-sql
Ok, if I want to get non-aggregat data in groups, I use order by. This
group by seemed so logical though, but the fruit that u can't have, is
usually the most sweet.
New question, how to get the last day of month(order data by last day of
month). And to prevent chain letter from misunderstanding, no I don't
intend to look it up from calendar and then input it manually.
A.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: GROUP by finish&&last day of month
2000-07-05 12:32 GROUP by finish&&last day of month Antti Linno <alligator@all.ee>
@ 2000-07-05 12:46 ` Jerome Alet <alet@unice.fr>
2 siblings, 0 replies; 4+ messages in thread
From: Jerome Alet @ 2000-07-05 12:46 UTC (permalink / raw)
To: Antti Linno <alligator@all.ee>; +Cc: pgsql-sql
On Wed, 5 Jul 2000, Antti Linno wrote:
> New question, how to get the last day of month(order data by last day of
> month).
I'm sorry but I don't understand how you could order something by a value
(last day of month).
you can only order things by a field (e.g. a date field) or fields, in
increasing or decreasing order.
e.g.:
you can do:
SELECT id,eventdate FROM mytable ORDER BY eventdate DESC;
and not:
SELECT id,eventdate FROM mytable ORDER BY '2000-01-31' DESC;
the latter one doesn't mean anything to me, nor to SQL I suppose.
bye,
Jerome ALET - alet@unice.fr - http://cortex.unice.fr/~jerome
Faculte de Medecine de Nice - http://noe.unice.fr - Tel: 04 93 37 76 30
28 Avenue de Valombrose - 06107 NICE Cedex 2 - FRANCE
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: GROUP by finish&&last day of month
2000-07-05 12:32 GROUP by finish&&last day of month Antti Linno <alligator@all.ee>
@ 2000-07-05 13:00 ` tjk@tksoft.com <tjk@tksoft.com>
2 siblings, 0 replies; 4+ messages in thread
From: tjk@tksoft.com @ 2000-07-05 13:00 UTC (permalink / raw)
To: alligator@all.ee; +Cc: pgsql-sql
Not quite sure what you mean, but how about this:
select date_part('day', 'Jul 01 00:00:00 2000 PDT'::datetime-1);
You must specify Jul for June, i.e. always the following month.
You could get around that too, but since I don't know why you
need to do what you asked, I'll leave it at this.
Troy
>
> Ok, if I want to get non-aggregat data in groups, I use order by. This
> group by seemed so logical though, but the fruit that u can't have, is
> usually the most sweet.
>
> New question, how to get the last day of month(order data by last day of
> month). And to prevent chain letter from misunderstanding, no I don't
> intend to look it up from calendar and then input it manually.
>
> A.
>
>
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: GROUP by finish&&last day of month
2000-07-05 12:32 GROUP by finish&&last day of month Antti Linno <alligator@all.ee>
@ 2000-07-05 15:00 ` Patrick Jacquot <patrick.jacquot@anpe.fr>
2 siblings, 0 replies; 4+ messages in thread
From: Patrick Jacquot @ 2000-07-05 15:00 UTC (permalink / raw)
To: Antti Linno <alligator@all.ee>; +Cc: pgsql-sql
Antti Linno wrote:
> Ok, if I want to get non-aggregat data in groups, I use order by. This
> group by seemed so logical though, but the fruit that u can't have, is
> usually the most sweet.
>
> New question, how to get the last day of month(order data by last day of
> month). And to prevent chain letter from misunderstanding, no I don't
> intend to look it up from calendar and then input it manually.
>
> A.
to get last day of month :
1) use date-trunc to truncate to first day of month
2) add one month
3) substract 1 day
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2000-07-05 15:00 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-07-05 12:32 GROUP by finish&&last day of month Antti Linno <alligator@all.ee>
2000-07-05 12:46 ` Jerome Alet <alet@unice.fr>
2000-07-05 13:00 ` tjk@tksoft.com <tjk@tksoft.com>
2000-07-05 15:00 ` Patrick Jacquot <patrick.jacquot@anpe.fr>
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