[SQL] Prepare Statement

2004-06-14 Thread Jie Liang
Hi, I have a question about performance, in SQL commands: there is a prepare/execute command, document says it will improve the performance while repeatly execute a statement. In java.sql: there is a PreparedStatement object, which can store precompiled SQL statement, document says it can improve

Re: [SQL] Scalar subqueries

2004-06-14 Thread Richard Poole
On Mon, Jun 14, 2004 at 12:38:44PM -0700, Subbiah, Stalin wrote: > > I've a logs table that has both sign-in and sign-out records which are > differentiated by action flag. Records with action flag = (1,2) => sign-in > records and action flag = (3,4,5,6,7) => sign-out records. > All I'm trying

Re: [SQL] query with =ALL

2004-06-14 Thread Stephan Szabo
On Mon, 14 Jun 2004, Tom Lane wrote: > "Jaime Casanova" <[EMAIL PROTECTED]> writes: > > AND > > CPA.cur_paralelo = ALL (SELECT cur_paralelo FROM aca_t_curso ...) > > Wait a second ... we are all overthinking the problem. The subselect > returns three *different* values. It is not possible for a

Re: [SQL] query with =ALL

2004-06-14 Thread Jaime Casanova
You're not expressing yourself clearly, because as far as I can understand you there are guaranteed to be no such results. regards, tom lane ok, the output i want is equivalent to: SELECT CPA.rub_codigo, RUB.rub_descripcion, CPA.cpa_valor, CPA.cpa_fechavencimiento FROM rec_m_cuadropagos CPA, re

Re: [SQL] query with =ALL

2004-06-14 Thread Tom Lane
"Jaime Casanova" <[EMAIL PROTECTED]> writes: >> Perhaps you meant "= ANY"? > Not really becuase ANY has the same efect that IN and what i want is all the > results that are equal in all the rows in any of the cur_paralelo values. > But must be in all the cur_paralelo or nothing. You're not expr

Re: [SQL] query with =ALL

2004-06-14 Thread Jaime Casanova
Hi all, > AND > CPA.cur_paralelo = ALL (SELECT cur_paralelo FROM aca_t_curso ...) Wait a second ... we are all overthinking the problem. The subselect returns three *different* values. It is not possible for any CPA.cur_paralelo values to be simultaneously equal to all three. So this test certain

[SQL] Scalar subqueries

2004-06-14 Thread Subbiah, Stalin
__sorry for posting it second time__ Not sure what am I missing. I really appreciate if anyone could point it out to me. I've a logs table that has both sign-in and sign-out records which are differentiated by action flag. Records with action flag = (1,2) => sign-in records and action flag = (3,4

Re: [SQL] query with =ALL

2004-06-14 Thread Tom Lane
"Jaime Casanova" <[EMAIL PROTECTED]> writes: > AND > CPA.cur_paralelo = ALL (SELECT cur_paralelo FROM aca_t_curso ...) Wait a second ... we are all overthinking the problem. The subselect returns three *different* values. It is not possible for any CPA.cur_paralelo values to be simultaneously eq

Re: [SQL] a query with = ALL

2004-06-14 Thread Jaime Casanova
"Jaime Casanova" <[EMAIL PROTECTED]> writes: brings 'A ', 'B ', 'C ' well when i cHange the real query Given that you spelled it like that, I wonder whether you aren't confused about the behavior of cross-data-type comparisons. If one column is char(n) and the other is text or varchar(n) then you

Re: [SQL] query with =ALL

2004-06-14 Thread Jaime Casanova
> On Mon, 14 Jun 2004, Jaime Casanova wrote: > > > On Mon, 14 Jun 2004, Jaime Casanova wrote: > > > > > i have an strange result here, i'm using 7.4.2 on redhat 8 > > > > > > i have a query like this > > > > > > SELECT CPA.rub_codigo, RUB.rub_descripcion, CPA.cpa_valor, > > > CPA.cpa_

Re: RES: [SQL] Datetime problem

2004-06-14 Thread Tom Lane
"Alexander M. Pravking" <[EMAIL PROTECTED]> writes: > Hmm, 7.3 and 7.4 docs say that it returns timestamp (WITHOUT time zone > is default since 7.3 IIRC), but in fact it accepts and returns timestamp > WITH time zone. This is probably a documentation bug... Yeah, it is. Fixed in CVS tip --- thank

Re: RES: [SQL] Datetime problem

2004-06-14 Thread Tom Lane
"Eric Lemes" <[EMAIL PROTECTED]> writes: > - PostgreSQL 7.3.2 on i386-redhat-linux GCC 3.2.2 > - Timezone: Brazil (GMT-3, I think). Ah, and 2004-10-10 is a daylight savings transition day where you live, right? (Or at least the obsolete timezone file you have thinks so...) So local midnight on th

Re: [SQL] a query with = ALL

2004-06-14 Thread Tom Lane
"Jaime Casanova" <[EMAIL PROTECTED]> writes: > brings 'A ', 'B ', 'C ' well when i cHange the real query Given that you spelled it like that, I wonder whether you aren't confused about the behavior of cross-data-type comparisons. If one column is char(n) and the other is text or varchar(n) then y

Re: [SQL] max value from join

2004-06-14 Thread Richard Poole
On Mon, Jun 14, 2004 at 11:02:06AM -0500, hook wrote: > I have a court program with related tables > I am trying to extract data related to the last conttinue date using > select >c.citkey, /* c.cdate, >c.badge, c.vioDesc, >b.lname, b.fname,b.mi, b.race, b.dob, b.

Re: [SQL] query with =ALL

2004-06-14 Thread Stephan Szabo
On Mon, 14 Jun 2004, Jaime Casanova wrote: > On Mon, 14 Jun 2004, Jaime Casanova wrote: > > > i have an strange result here, i'm using 7.4.2 on redhat 8 > > > > i have a query like this > > > > SELECT CPA.rub_codigo, RUB.rub_descripcion, CPA.cpa_valor, > > CPA.cpa_fechavencimiento > > FROM

Re: [SQL] query with =ALL

2004-06-14 Thread Jaime Casanova
On Mon, 14 Jun 2004, Jaime Casanova wrote: > i have an strange result here, i'm using 7.4.2 on redhat 8 > > i have a query like this > > SELECT CPA.rub_codigo, RUB.rub_descripcion, CPA.cpa_valor, > CPA.cpa_fechavencimiento > FROM rec_m_cuadropagos CPA, rec_m_rubro RUB > WHERE RUB.ent_codigo = CPA.e

Re: [SQL] query with =ALL

2004-06-14 Thread Jaime Casanova
Jaime Casanova wrote: Hi all, i have an strange result here, i'm using 7.4.2 on redhat 8 i have a query like this [snip] this query proves that its result is 'A', 'B', 'C' any idea, is something wrong in my thinking? Do you have any null values involved? That might well interfere (though I admit

Re: [SQL] query with =ALL

2004-06-14 Thread Richard Huxton
Jaime Casanova wrote: Hi all, i have an strange result here, i'm using 7.4.2 on redhat 8 i have a query like this [snip] this query proves that its result is 'A', 'B', 'C' any idea, is something wrong in my thinking? Do you have any null values involved? That might well interfere (though I admit I

Re: [SQL] query with =ALL

2004-06-14 Thread Stephan Szabo
On Mon, 14 Jun 2004, Jaime Casanova wrote: > i have an strange result here, i'm using 7.4.2 on redhat 8 > > i have a query like this > > SELECT CPA.rub_codigo, RUB.rub_descripcion, CPA.cpa_valor, > CPA.cpa_fechavencimiento > FROM rec_m_cuadropagos CPA, rec_m_rubro RUB > WHERE RUB.ent_codigo = CPA

Re: RES: [SQL] Datetime problem

2004-06-14 Thread Alexander M. Pravking
On Mon, Jun 14, 2004 at 01:20:14PM -0300, Eric Lemes wrote: > Hello, > > - PostgreSQL 7.3.2 on i386-redhat-linux GCC 3.2.2 > - Timezone: Brazil (GMT-3, I think). What's about daylight saving time for you? I'm almost sure the DST boundary is near the date in your example. However, with 7.3.4 on F

[SQL] a query with = ALL

2004-06-14 Thread Jaime Casanova
Hi all, some more info a think can be useful to probe there is somting wrong. I pointed that the query select cur_paralelo from rec_m_cuadropagos WHERE ent_codigo = 1 AND sec_codigo = 1 AND

[SQL] query with =ALL

2004-06-14 Thread Jaime Casanova
Hi all, i have an strange result here, i'm using 7.4.2 on redhat 8 i have a query like this SELECT CPA.rub_codigo, RUB.rub_descripcion, CPA.cpa_valor, CPA.cpa_fechavencimiento FROM rec_m_cuadropagos CPA, rec_m_rubro RUB WHERE RUB.ent_codigo = CPA.ent_codigo AND RUB.rub_codigo = CPA.rub_codigo AND

RES: [SQL] Datetime problem

2004-06-14 Thread Eric Lemes
Hello, - PostgreSQL 7.3.2 on i386-redhat-linux GCC 3.2.2 - Timezone: Brazil (GMT-3, I think). I think my problem is with the time zone. Using a SET TIME ZONE GMT, the result is Ok. But I don't know how to work with time zones correctly. When I send a date to to_timestamp, pgsql thinks this date

[SQL] max value from join

2004-06-14 Thread hook
I have a court program with related tables citation citkey varchar(16) NOT NULL PRIMARY KEY, cdefendant citkey varchar(16) NOT NULL PRIMARY KEY references citation, ccourt citkey varchar(16) NOT NULL PRIMARY KEY references citation, disposition citke

Re: [SQL] Datetime problem

2004-06-14 Thread Tom Lane
"Eric Lemes" <[EMAIL PROTECTED]> writes: > - select to_timestamp('2004 10 10 00 00 00', ' MM DD HH MI SS') > the output is: > - 2004-10-09 23:00:00-03 What PG version is this, on what platform, and what's your current timezone setting? regards, tom lane --

Re: [SQL] Datetime problem

2004-06-14 Thread Achilleus Mantzios
O kyrios Eric Lemes egrapse stis Jun 14, 2004 : > Hello there, > > I'm with a little trouble with postgresql and date/time conversions: > > - select to_timestamp('2004 10 10 00 00 00', ' MM DD HH MI SS') > > the output is: > > - 2004-10-09 23:00:00-03 Just do select to_timestamp('2004 10

Re: [SQL] Datetime problem

2004-06-14 Thread Stef
Hello Eric, Are you looking for something like : select to_char(timestamp 'now',' MM DD HH MI SS'); or the values in your example below : select to_char(timestamp '20041010 00:00:00',' MM DD HH MI SS'); Eric Lemes mentioned : => Hello there, => => I'm with a little trouble with postgresq

[SQL] Datetime problem

2004-06-14 Thread Eric Lemes
Hello there,   I'm with a little trouble with postgresql and date/time conversions:   - select to_timestamp('2004 10 10 00 00 00', ' MM DD HH MI SS')   the output is:   - 2004-10-09 23:00:00-03   Anybody can help me?     []'s   Eric Lemes de Godoy Cintra Analista de Sistemas Líder