| From: | "Katka a Daniel Dunajsky" <daniel_katka(at)hotmail(dot)com> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Why this query does not work? |
| Date: | 2003-05-12 17:55:57 |
| Message-ID: | Law12-F699Fekzabtne00013e38@hotmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Achilleus Mantzios | 2003-05-12 20:30:11 | Re: epoch to timestamp |
| Previous Message | Chris Linstruth | 2003-05-12 17:13:32 | Re: epoch to timestamp |