Query problem

From: Clemens Schwaighofer <cs(at)tequila(dot)co(dot)jp>
To: pgsql-general(at)postgresql(dot)org
Subject: Query problem
Date: 2007-10-12 13:14:28
Message-ID: 470F7334.1040709@tequila.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi,

thats the first time I am a bit confused by a query not working.

I have this table:

gullevek=# \d test
Table "public.test"
Column | Type | Modifiers
---------+-------------------+--------------------------------------------------------
test_id | integer | not null default
nextval('test_test_id_seq'::regclass)
email_a | character varying |
email_b | character varying |
Indexes:
"test_pkey" PRIMARY KEY, btree (test_id)

with this content:

gullevek=# select * from test;
test_id | email_a | email_b
---------+---------------+-------------
2 | test(at)test(dot)com | bar(at)foo(dot)com
1 | foo(at)bar(dot)com |
(2 rows)

if I do this select:

select * from (select test_id, email_a FROM test WHERE email_a =
'moo(at)boo(dot)com') as s, (select test_id, email_b from test where email_b =
'bar(at)foo(dot)com') as t;

I get no rows back. should it return something? subquery a doesn't
return one, because the email does not exist, b returns something.

how do I have to make the query so I get a result back and in one row?

--
[ Clemens Schwaighofer -----=====:::::~ ]
[ TEQUILA\ Japan IT Group ]
[ 6-17-2 Ginza Chuo-ku, Tokyo 104-8167, JAPAN ]
[ Tel: +81-(0)3-3545-7703 Fax: +81-(0)3-3545-7343 ]
[ http://www.tequila.co.jp ]

Responses

Browse pgsql-general by date

  From Date Subject
Next Message tfinneid 2007-10-12 13:44:16 Re: how to truncate/purge the pg_xlog directory?
Previous Message Alexander Kuprijanov 2007-10-12 13:11:16 different date-time in base and in system