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