Re: [SQL] "for SELECT DISTINCT, ORDER BY expressions must appear in select list" - is that the standart or a limitation of postgresql?

2007-02-15 Thread Walter Cruz
Thanks Tom, Thank all :) Maybe the commentary on parse_clase.c (beggining with "Now, DISTINCT list consists of all non-resjunk") needs to be updated - In the comment, looks likes this is a postgresql limitation. []'s - Walter On 2/15/07, Tom Lane <[EMAIL PROTECTED]> wrote: Michael Glaesemann <

Re: [SQL] Retrieving 'Credit' when 'C'

2007-02-15 Thread Phillip Smith
SELECT when, CASE WHEN type = 'C' THEN 'Credit' END AS type FROMmytable; Assuming your column names are actually "when" and "type" you should just have to change "mytable" to the correct table name and run in psql or the SQL Window of pgAdmin or wherever you usually run your SQL

Re: [SQL] "for SELECT DISTINCT, ORDER BY expressions must appear in select list" - is that the standart or a limitation of postgresql?

2007-02-15 Thread Tom Lane
Michael Glaesemann <[EMAIL PROTECTED]> writes: > On Feb 15, 2007, at 22:35 , Richard Huxton wrote: >> Walter Cruz wrote: >>> The error: ERROR: for SELECT DISTINCT, ORDER BY expressions must >>> appear in select list is due to a standart implementarion or a design >>> decision of postgres? >> >> I

Re: [SQL] can someone explain confusing array indexing nomenclature

2007-02-15 Thread chrisj
Thanks Achilleas, I see what you are saying, but if we consider just the index "[2]" for a moment, it means something different depending upon the context (in one case it means "2" and in the other case it means "1:2") and the context is determined by the format of indexes on other dimensions.

Re: [SQL] Retrieving 'Credit' when 'C'

2007-02-15 Thread Ezequias Rodrigues da Rocha
Just a question, where to put it ? I didn't notice yet. Ezequias 2007/2/15, Alvaro Herrera <[EMAIL PROTECTED]>: Ezequias Rodrigues da Rocha escribió: > Hello, > > Does anyone know how to make a Select that even having a Char(1) with the > letter C the statement makes the rows appearing 'CREDIT

Re: [SQL] Retrieving 'Credit' when 'C'

2007-02-15 Thread Alvaro Herrera
Ezequias Rodrigues da Rocha escribió: > Hello, > > Does anyone know how to make a Select that even having a Char(1) with the > letter C the statement makes the rows appearing 'CREDIT' ? case when column = 'C' then 'CREDIT' end -- Alvaro Herrerahttp://www.CommandP

Re: [SQL] Retrieving 'Credit' when 'C'

2007-02-15 Thread Rodrigo De León
SELECT CASE WHEN TYPE = 'C' THEN 'CREDIT' END AS TYPE FROM mytable ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

[SQL] Retrieving 'Credit' when 'C'

2007-02-15 Thread Ezequias Rodrigues da Rocha
Hello, Does anyone know how to make a Select that even having a Char(1) with the letter C the statement makes the rows appearing 'CREDIT' ? Like: On table: When Type 2007-01-01C 2007-01-02C 2007-01-03C On SQL result When Type 2007-01-01CREDIT 2007-01-02CREDI

Re: [SQL] "for SELECT DISTINCT, ORDER BY expressions must appear in select list" - is that the standart or a limitation of postgresql?

2007-02-15 Thread Michael Glaesemann
On Feb 15, 2007, at 22:35 , Richard Huxton wrote: Walter Cruz wrote: SELECT distinct name from test order by number (well, I think that que query doesn't make any sense, but raises the error :) ) The error: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list is due

Re: [SQL] "for SELECT DISTINCT, ORDER BY expressions must appear in select list" - is that the standart or a limitation of postgresql?

2007-02-15 Thread Richard Huxton
Walter Cruz wrote: SELECT distinct name from test order by number (well, I think that que query doesn't make any sense, but raises the error :) ) The error: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list is due to a standart implementarion or a design decision o

[SQL] "for SELECT DISTINCT, ORDER BY expressions must appear in select list" - is that the standart or a limitation of postgresql?

2007-02-15 Thread Walter Cruz
CREATE TABLE test ( id int4 NOT NULL DEFAULT nextval('teste_id_seq'::regclass), name varchar, number int4 ) WITHOUT OIDS; The data: 1;"walter";1 2;"walter";1 3;"walter";1 4;"walter";1 5;"walter";2 6;"walter";3 7;"rodrigo";1 8;"rodrigo";2 9;"rodrigo";3 The query: SELECT distinct name from te

Re: [SQL] can someone explain confusing array indexing nomenclature

2007-02-15 Thread Achilleas Mantzios
Στις Τετάρτη 14 Φεβρουάριος 2007 21:31, ο/η chrisj έγραψε: > given the following table: > > protocal2=> select * from sal_emp ; > name | pay_by_quarter | schedule > ---+---+--- > Bill | {1,1,10