From: Haller Christoph <ch@rodos.fzk.de>
To: guru@indvalley.com
Cc: pgsql-sql@postgresql.org
Subject: Re: Joins!!
Date: Tue, 13 Nov 2001 9:35:24 MET
Message-ID: <200111130835.JAA23920@rodos> (raw)
In-Reply-To: <35769563.20011113111543@indvalley.com>
>
> Q 1. Consider the following query, suppose I want the sum of the
> tickettabcount and ticketmultabcount, how do I modify my query to get the
> same. If I use operator "+" in between these, it's been ignored by the
> PgSQL and throws a error!!
>
> QUERY
> -----
> select count(tickettab.tokenid) as tickettabcount,
> (select count(tokenid) from ticketmultab
> where agentid='danny' and arrivaldate='2001-11-12') as
> ticketmultabcount
> from tickettab
> where tickettab.agentid='danny' and
> tickettab.arrivaldate='2001-11-12'
>
> RESULT
> -------
>
>
> tickettabcount || ticketmultabcount
> ------------- ------------------
> 9 2
>
Don't use the column name aliasing and it should work:
select sum(tickettab.tokenid) +
(select sum(tokenid) from ticketmultab
where agentid='danny' and arrivaldate='2001-11-12')
from tickettab
where tickettab.agentid='danny' and
tickettab.arrivaldate='2001-11-12' ;
>
>
> Q 2. I join two tables, I get a result set which has values from
> both the tables, now if I want to sort the combination of the result
> set how do I do that!!, not the individual table result set.
>
What is so mysterious about your join?
To answer your question, it would be very helpful to see the query
instead of reading prose.
Reagrds, Christoph
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: ch@rodos.fzk.de, guru@indvalley.com
Subject: Re: Joins!!
In-Reply-To: <200111130835.JAA23920@rodos>
* 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