Re: [SQL] Which SQL query makes it possible to optain the 3 greatest values of an interger list ?

2001-09-14 Thread Wei Weng
I would use SELECT id FROM table ORDER BY id LIMIT 0, 3; in order to get the top 3 results. The key is "Limit" keyword. == Wei Weng Network Software Engineer KenCast Inc. > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of Yoann > Sent:

Re: [SQL] How do I extract ONE particular field, when multiple table contain the same field name?

2001-09-14 Thread Christof Glaser
On Wednesday, 12. September 2001 11:06, Olle Wijk wrote: > Hi, > > I am pretty new att using SQL-quires, could anyone help me with this > one: > > I want to do the following SQL-query: > > Select XID, DENOM, PRICE, FRT, CTID From XItem xi, Category c Where > xi.System=1 and xi.Category=c.Index > >

Re: [SQL] Which SQL query makes it possible to optain the 3 greatest

2001-09-14 Thread Patrik Kudo
On 12 Sep 2001, Yoann wrote: > OO( Sql Problem )Oo. > > That is to say a table of 5 inputs of 1 integer field : > >Table = { (1); (12); (3); (9); (4) } Am I right that what you have is this? CREATE TABLE T (v integer); INSERT INTO T (v) VALUES (1); INSERT INTO T (v) VALUES (12); INSERT INTO

Re: [SQL] Number the lines

2001-09-14 Thread Jeff Eckermann
If you want "the third maximum value", easist to do: SELECT * FROM table ORDER BY whatever DESC OFFSET 2 LIMIT 1; - Original Message - From: "Yoann" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, September 14, 2001 7:05 AM Subject: Number the lines > how can I number the res

Re: [SQL] SQL request change when upgrade from 7.0.2 to 7.1.3

2001-09-14 Thread Josh Berkus
Richard, I'm curious now. What happens if you remove the table qualifications, e.g.: ORDER BY type, nom; -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus Complete information technology [EMAIL PROTECTED] and data man

Re: [SQL] SQL request change when upgrade from 7.0.2 to 7.1.3

2001-09-14 Thread Josh Berkus
Mr. Nagy, > Recently, I have upgraded my postgresql server from 7.0.2 to 7.1.3. > But, > now, one request which was 'good' before, don't want to work any more > now. I'm not sure I understand your question. What do you mean "doesn't work"? Please give a detailed list of all steps taken, includi

Re: [SQL] How do I extract ONE particular field, when multiple table

2001-09-14 Thread Patrik Kudo
What you want to know is probably this: Select XID, xi.DENOM, PRICE, FRT, CTID From XItem xi, Category c Where xi.System=1 and xi.Category=c.Index Regards, Patrik Kudo ---(end of broadcast)--- TIP 2: you can get off all lists at once with the un

Re: [SQL] SQL request change when upgrade from 7.0.2 to 7.1.3

2001-09-14 Thread Richard NAGY
Josh Berkus a écrit : Mr. Nagy, > Recently, I have upgraded my postgresql server from 7.0.2 to 7.1.3. > But, > now, one request which was 'good' before, don't want to work any more > now. I'm not sure I understand your question.  What do you mean "doesn't work"? Please give a detailed list of all

[SQL] array variable in pl/pgsql

2001-09-14 Thread jack
Hi all Is there any sample to show how to use array variable in PL/pgsql? How do I get an array from a table and do a loop to manipulate every element in that array? jack ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http:/

[SQL] array variable in pl/pgsql

2001-09-14 Thread datactrl
Hi all Is there any sample to show how to use array variable in PL/pgsql? How do I get an array from a table and do a loop to manipulate every element in that array? jack ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please

[SQL] Which SQL query makes it possible to optain the 3 greatest values of an interger list ?

2001-09-14 Thread Yoann
OO( Sql Problem )Oo. That is to say a table of 5 inputs of 1 integer field : Table = { (1); (12); (3); (9); (4) } We want to obtain a result of 1 input of 3 fields, corresponding to the 3 greatest values of Table, by descending order : Result = { (12; 9; 4) } => Which SQL query ma

[SQL] using LATIN1 ?

2001-09-14 Thread Domingo Alvarez Duarte
I've compiled postgresql with multi-byte support, and created a database with: create database l1 with encoding 'LATIN1'; It was created succefull. I started "psql l1" and issued this query "select upper('á')" and get back "á" expected "Á". I created a table with "create table test(f varchar(5

Re: [SQL] Combine query views into one SQL string

2001-09-14 Thread Gledatelj
Hy Maik, you can select it directly from the tables using following sql statement (but it's same as using views): select t1.id, t1.f1, t2.f2 from (select id, sum(amount) f1 from table1 group by id) t1, (select id, sum(amount) f2 from table2 group by id) t2 where t1.id = t2.id but,

Re: [SQL] Combine query views into one SQL string

2001-09-14 Thread Tony Hunt
I don't get it? What's the difference between an inner-join and an equijoin? "Nils Zonneveld" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Maik wrote: > > > > Its clear, union concat the two results. > > > > But he can also use this join version, if its

Re: [SQL] How do I extract ONE particular field, when multiple table contain the same field name?

2001-09-14 Thread Jeff Eckermann
You need to qualify "DENOM" with the table name: just write "xi.DENOM". I find this to be good general practice when selecting from more than one table. - Original Message - From: "Olle Wijk" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, September 12, 2001 4:06 AM Subject:

Re: [SQL] How do I extract ONE particular field, when multiple table contain the same field name?

2001-09-14 Thread Yoann
[EMAIL PROTECTED] (Olle Wijk) wrote in message news:<[EMAIL PROTECTED]>... > Hi, > > I am pretty new att using SQL-quires, could anyone help me with this > one: > > I want to do the following SQL-query: > > Select XID, DENOM, PRICE, FRT, CTID From XItem xi, Category c Where > xi.System=1 and x

Re: [SQL] SQL request change when upgrade from 7.0.2 to 7.1.3

2001-09-14 Thread Andre Schnabel
Can you post the exact errormessage? - Original Message - From: "Richard NAGY" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, September 14, 2001 12:11 PM Subject: [SQL] SQL request change when upgrade from 7.0.2 to 7.1.3 > Hello, > > Recently, I have upgraded my postgresql

Re: [SQL] Combine query views into one SQL string

2001-09-14 Thread Eimas
"Maik" <[EMAIL PROTECTED]> wrote in message news:<9na15r$ku4$[EMAIL PROTECTED]>... > Its clear, union concat the two results. > > But he can also use this join version, if its the intention. > > select t1.id, sum(t1.amount), t2.id, sum(t2.amount) from table1 as t1, > table2 as t2 where t1.id=t2

[SQL] array variable in pl/pgsql

2001-09-14 Thread datactrl
Hi all Is there any sample to show how to use array variable in PL/pgsql? How do I get an array from a table and do a loop to manipulate every element in that array? jack ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http:

[SQL] To query many tables.

2001-09-14 Thread trebischt
Hi, I have to query many tables (about 18 tables) from a database to field a riport in HTML. I can make the query and it works (I think), but it's a bit strange to me. The query looks like this: select * from table1 f, table2 s, table3 t, table4 fo, table5 fi, table6 si, table 7 se, table8 e, t

[SQL] array variables in pl/pgsql

2001-09-14 Thread Jack
Is there any sample to show how to use array variable in PL/pgsql? How do I get an array from a table and do a loop to manipulate every element in that array? jack ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregi

[SQL] How do I extract ONE particular field, when multiple table contain the same field name?

2001-09-14 Thread Olle Wijk
Hi, I am pretty new att using SQL-quires, could anyone help me with this one: I want to do the following SQL-query: Select XID, DENOM, PRICE, FRT, CTID From XItem xi, Category c Where xi.System=1 and xi.Category=c.Index the problem is that the field 'DENOM' is present in both table 'XItem' and

Re: [SQL] Combine query views into one SQL string

2001-09-14 Thread Nils Zonneveld
Maik wrote: > > Its clear, union concat the two results. > > But he can also use this join version, if its the intention. > > select t1.id, sum(t1.amount), t2.id, sum(t2.amount) from table1 as t1, > table2 as t2 where t1.id=t2.id; > Yeps, thats another way to write an inner join :-) Mazzel

[SQL] Urgent: How to set autocommit off in postgres.........

2001-09-14 Thread [EMAIL PROTECTED]
Hi , I read one of solution to andreas problem of how to set autocommit off but my problem still persists. I am basically writing a function in plpgsql language which performs a number of update and insert statements but on a failing condition it rollbacks inorder to maintain integrity in the d

Re: [SQL] Combine query views into one SQL string

2001-09-14 Thread Nils Zonneveld
Maik wrote: > > With "Union" you can create one view. > Ciao Maik UNION wouldn't have the desired effect: the result of a UNION SELECT would look like this: ID AMOUNT 1 (table1.amount) 2 (table1.amount) . . . . 1 (table2.amount) 2 (table2.amount) What he wants is: ID TABLE1.AMOUNT

[SQL] Number the lines

2001-09-14 Thread Yoann
how can I number the result's lines of a sql query ? explaination : I have a query which return me a list of values. I need to order them (it's ok, easy ;) and then number the lines. The goal is then to extract, for example, "the third maximum value". Tx in advance ! Yoann -

Re: [SQL] Combine query views into one SQL string

2001-09-14 Thread Maik
Its clear, union concat the two results. But he can also use this join version, if its the intention. select t1.id, sum(t1.amount), t2.id, sum(t2.amount) from table1 as t1, table2 as t2 where t1.id=t2.id; Ciao Maik ---(end of broadcast)--- TIP

Re: [SQL]

2001-09-14 Thread Peter Eisentraut
Bhuvan A writes: > SELECT EXTRACT(EPOCH FROM TIMESTAMP(now())); > date_part > > 1000467997 > (1 row) > > Fine.. > > Similarly, how could i get timestamp value for these SECONDS? TIMESTAMP 'epoch' + INTERVAL 'N seconds' -- Peter Eisentraut [EMAIL PROTECTED] http://funkturm.ho

[SQL] How to Get Timestamp From SECONDS?

2001-09-14 Thread Bhuvan A
Hi all, Consider this.. SELECT EXTRACT(EPOCH FROM TIMESTAMP(now())); date_part 1000467997 (1 row) Fine.. Similarly, how could i get timestamp value for SECONDS? ie.. VICE VERSA Something like this.. :) select extract(timestamp from interval('1000467997 seconds')); :) Ki

[SQL]

2001-09-14 Thread Bhuvan A
Hi all, Consider this.. SELECT EXTRACT(EPOCH FROM TIMESTAMP(now())); date_part 1000467997 (1 row) Fine.. Similarly, how could i get timestamp value for these SECONDS? ie.. VICE VERSA Something like this.. SELECT EXTRACT(TIMESTAMP FROM INTERVAL('1000467997 SECONDS')); :) K

[SQL] SQL request change when upgrade from 7.0.2 to 7.1.3

2001-09-14 Thread Richard NAGY
Hello, Recently, I have upgraded my postgresql server from 7.0.2 to 7.1.3. But, now, one request which was 'good' before, don't want to work any more now. It was : (pretty long) SELECT aes.ent_id, e.type, e.nom, aes.sect_id as voulu, cvd_new(current_date, e.date_entree, 'new') FROM ass_entrep_sec