Στις Τετάρτη 14 Φεβρουάριος 2007 21:31, ο/η chrisj έγραψε:
> given the following table:
>
> protocal2=> select * from sal_emp ;
> name | pay_by_quarter | schedule
> ---+---+---
> Bill | {1,1,10
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
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
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
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
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
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
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
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.
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
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
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 <
12 matches
Mail list logo