From: Katka a Daniel Dunajsky <daniel_katka@hotmail.com>
To: pgsql-sql@postgresql.org
Subject: Why this query does not work?
Date: Mon, 12 May 2003 11:55:57 -0600
Message-ID: <Law12-F699Fekzabtne00013e38@hotmail.com> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: daniel_katka@hotmail.com
Subject: Re: Why this query does not work?
In-Reply-To: <Law12-F699Fekzabtne00013e38@hotmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox