pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedORDER the result of a query by date
3+ messages / 3 participants
[nested] [flat]
* ORDER the result of a query by date
@ 2002-10-24 10:57 andres javier garcia garcia <andresjavier.garcia@wanadoo.es>
2002-10-24 11:28 ` Re: ORDER the result of a query by date Achilleus Mantzios <achill@matrix.gatewaynet.com>
0 siblings, 1 reply; 3+ messages in thread
From: andres javier garcia garcia @ 2002-10-24 10:57 UTC (permalink / raw)
To: pgsql-sql
Hello;
I've got the result of a query that appears as:
cod_variable | cod_station | year | month | day | rain
---------------------+-------------------+--------+----------+------+------
30201 | 7237 | 1953 | 1 | 1 | 2
30201 | 7237 | 1953 | 2 | 1 | 5
30201 | 7237 | 1953 | 3 | 1 | 0
30201 | 7237 | 1953 | 4 | 1 | -3
.....
(Of course, thanks to Stephan Szabo for the method to obtain this from my
strange source data. I didn't think this was possible.)
After have done this query I've realized that I need the data to be ordered
by date. Do you have any suggestion?
Best regards
----------
Javier
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: ORDER the result of a query by date
2002-10-24 10:57 ORDER the result of a query by date andres javier garcia garcia <andresjavier.garcia@wanadoo.es>
@ 2002-10-24 11:28 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
0 siblings, 0 replies; 3+ messages in thread
From: Achilleus Mantzios @ 2002-10-24 11:28 UTC (permalink / raw)
To: andres javier garcia garcia <andresjavier.garcia@wanadoo.es>; +Cc: pgsql-sql
On Thu, 24 Oct 2002, andres javier garcia garcia wrote:
> Hello;
> I've got the result of a query that appears as:
> cod_variable | cod_station | year | month | day | rain
> ---------------------+-------------------+--------+----------+------+------
> 30201 | 7237 | 1953 | 1 | 1 | 2
> 30201 | 7237 | 1953 | 2 | 1 | 5
> 30201 | 7237 | 1953 | 3 | 1 | 0
> 30201 | 7237 | 1953 | 4 | 1 | -3
> .....
>
> (Of course, thanks to Stephan Szabo for the method to obtain this from my
> strange source data. I didn't think this was possible.)
>
> After have done this query I've realized that I need the data to be ordered
> by date. Do you have any suggestion?
select <your cols>,year,month,day from <your table> order by
year,month,day.
Also take a look at date,timestamp data types.
Note that you can process your initial "strange" source
using tools as awk,perl,sh,C programs to format
your datasets in sql insert statements or
copy format.
>
> Best regards
> ----------
> Javier
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>
==================================================================
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel: +30-10-8981112
fax: +30-10-8981877
email: achill@matrix.gatewaynet.com
mantzios@softlab.ece.ntua.gr
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: ORDER the result of a query by date
@ 2002-10-24 10:59 Henshall, Stuart - Design & Print <SHenshall@westcountry-design-print.co.uk>
0 siblings, 0 replies; 3+ messages in thread
From: Henshall, Stuart - Design & Print @ 2002-10-24 10:59 UTC (permalink / raw)
To: andres javier garcia garcia <andresjavier.garcia@wanadoo.es>; pgsql-sql
andres javier garcia garcia wrote:
> Hello;
> I've got the result of a query that appears as:
> cod_variable | cod_station | year | month | day | rain
> ---------------------+-------------------+--------+----------+
> ------+------
> 30201 | 7237 | 1953 | 1 | 1 | 2
> 30201 | 7237 | 1953 | 2 | 1 | 5
> 30201 | 7237 | 1953 | 3 | 1 | 0
> 30201 | 7237 | 1953 | 4 | 1 | -3 .....
>
> (Of course, thanks to Stephan Szabo for the method to obtain this
> from my strange source data. I didn't think this was possible.)
>
> After have done this query I've realized that I need the data to be
> ordered by date. Do you have any suggestion?
>
> Best regards
> ----------
> Javier
>
ORDER BY year,month,day should do it.
hth,
- Stuart
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2002-10-24 11:28 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-10-24 10:57 ORDER the result of a query by date andres javier garcia garcia <andresjavier.garcia@wanadoo.es>
2002-10-24 11:28 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
2002-10-24 10:59 Re: ORDER the result of a query by date Henshall, Stuart - Design & Print <SHenshall@westcountry-design-print.co.uk>
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