Why this query does not work? - Mailing list pgsql-sql

From Katka a Daniel Dunajsky
Subject Why this query does not work?
Date
Msg-id Law12-F699Fekzabtne00013e38@hotmail.com
Whole thread Raw
Responses Re: Why this query does not work?
Re: Why this query does not work?
List pgsql-sql
This works:

service0=# SELECT DISTINCT TO_CHAR(session_start, 'Month') as start,
service0-#                             TO_CHAR(session_start, 'Month') as 
end
service0-# FROM                   user_sessions
service0-# WHERE                 TO_CHAR(session_start, 'YYYY') = '2003';    start   |    end
-----------+----------- April     | April
(1 row)

Why this does not gives correct result?

service0=#
service0=# SELECT DISTINCT machine_id
service0-# FROM                   user_sessions
service0-# WHERE                 TO_CHAR(session_start, 'Month') = 'April';

machine_id
------------
(0 rows)

When this does have no problem?

service0=# SELECT DISTINCT machine_id
service0-# FROM                   user_sessions
service0-# WHERE                 TO_CHAR(session_start, 'Month') = (SELECT 
DISTINCT    TO_CHAR(session_start, 'Month')
service0(#                                                    FROM   
user_sessions);

machine_id
------------       123
(1 row)

Thank you for your time.

DanielD

_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail



pgsql-sql by date:

Previous
From: Chris Linstruth
Date:
Subject: Re: epoch to timestamp
Next
From: Tom Lane
Date:
Subject: Re: Why this query does not work?