Re: [SQL] join/group/count query.

2006-12-20 Thread Hector Villarreal
HI in reading this is it possible what was really intended : Sum(case when o_model = 5 then 1 else NULL end) as KA That would provide a count of all records meeting that condition. Otherwise the count( approach will not do that. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread Hector Villarreal
In case it is a version issue: This should always work regardless of version: Just cast the $1 variable as text followed by interval: create or replace function test(integer) returns setof text as $$ declare a record; begin select into a now() - ($1::text||'days')::interval; retu

Re: [SQL] Help with quotes in plpgsql

2006-12-19 Thread Hector Villarreal
Hi Not sure about $1 parms : you may need to use a variable to set $1 to then cast it as interval : create or replace function test(integer) returns setof text as $$ declare a record; begin select into a now() - ($1::text||'days')::interval; return next a; return; end $$

Re: [SQL] Question about time

2006-11-16 Thread Hector Villarreal
Try this one: SELECT date_trunc('seconds',now())::time; "15:11:42" So it should be select date_trunc('seconds', fecha_hora_factura)::time from nota_venta; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joe Sent: Thursday, November 16, 2006 2:24 PM To:

Re: [SQL] hi i am getting error...can u solve this

2006-11-02 Thread Hector Villarreal
What difference do you want to see? . Looks like your email got truncated. Please resend. There is not enough information to determine what is wanted.   From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Penchalaiah P. Sent: Thursday, November 02, 2006 4:50 AM To: pgs

Re: [SQL] Assigning a timestamp without timezone to a timestamp

2006-10-05 Thread Hector Villarreal
not understand the syntax. > Thanks in advance > Hector Villarreal > SELECT a.timestamp::timestamptz from (SELECT '2006-10-03 > 09:00'||"timezone" as timestamp from storetz where id = 1) as a; >timestamp > > -Original Message- >

Re: [SQL] Assigning a timestamp without timezone to a timestamp

2006-10-04 Thread Hector Villarreal
Hi I am also interested in this type of setup. However, in the example below I am a little confused as to why the table entry is 1, -3 And the subsequent select statement . I would appreciate an explanation on the select statement. I do not understand the syntax. Thanks in advance Hector