Re: [SQL] generate_series with left join

2006-06-28 Thread Pedro B.
On Wed, 2006-06-28 at 15:16 -0500, Aaron Bono wrote: > This should work too: > > select > year_list.year, > one_list.one_count, > two_list.two_count > FROM ( > select years > from generate_series(2006,2009) as years > ) year_list > left outer join ( > select > date

Re: [SQL] generate_series with left join

2006-06-28 Thread Pedro B.
On Wed, 2006-06-28 at 13:34 -0500, Aaron Bono wrote: > select > year_list.year, > count(one.*), > count(two.*) > from ( > select years > from generate_series(2006,2009) as years > ) year_list > left outer join mytable as one on ( > date_part('year', one.date) = year_list.y

[SQL] generate_series with left join

2006-06-28 Thread Pedro B.
Greetings. I'm having some difficulties with my first use of the generate_series function. Situation: cause| integer date | timestamp(2) without time zone cause | date --++---+ 1 | 2006-03-23 15:07:53.63 | 2

Re: [SQL] ... more than one count with left join

2006-02-20 Thread Pedro B.
gt;   2006-02-16 |>   2006-02-17 |>   2006-02-18 |>   2006-02-19 |>   2006-02-20 |>   2006-02-21 |>   2006-02-22 |>   2006-02-23 |>   2006-02-24 |>   2006-02-25 |>   2006-02-26 |>   2006-02-27 |>   2006-02-28 |>  (28 rows) |> |>  On Monday 20 February 2006 15:3

Re: [SQL] Given 02-01-2006 to 02-28-2006, output all days.

2006-02-20 Thread Pedro B.
Hello. I'm having difficulties on my first incursion through generate_series. The details: SELECT DATE_TRUNC('month', timestamp '2006-02-01' )::DATE + s.d AS date,       COUNT (o."04-sms") as totalcause98       FROM generate_series(11,19) AS s(d)  LEFT JOIN netopia o ON (substr(o."26-insertTime",

[SQL] PQexec and SPI_exec

2004-08-25 Thread Pedro B.
Hello everyone. I'm experiencing some doubts regarding a procedure i have (.c compiled as .so) running as an 'after insert for each row' trigger. This trigger is supposed to do a simple query, something like SELECT * FROM table order by id where processed=0 limit 1 It's not the perfect way to get

[SQL] Datetime

2004-08-03 Thread Pedro B.
Hello, I'm using a TIMESTAMP column with a now() default which (correctly i assume) uses a '-mm-dd hh:mm:ss' format. Is it possible to make it something like '-mm-dd hh:mm:ss:cc' ? (basically, a DATE and a TIME, but with 2 decimal cases on the :cc and not .c as the TIME format. Tha

[SQL] Newbie (to postgres) question

2004-07-08 Thread Pedro B.
Hello all, First of all, accept my apologies for what is surely a dumb question, and yes i have been reading extensively through all the documents, but i really need to ask this.. :) I have recently started the migration of a large ex-MySql database to postgresql, and im still "adapting" to the