Joins!!

From: Gurudutt <guru(at)indvalley(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Joins!!
Date: 2001-11-13 05:45:43
Message-ID: 35769563.20011113111543@indvalley.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php pgsql-sql

Hello,

I have few set of questions for the PGSQL list users

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

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.

Hoping for positive reply, thanks!!

--
Best regards,
Gurudutt mailto:guru(at)indvalley(dot)com

Life is not fair - get used to it.
Bill Gates

Responses

  • Re: Joins!! at 2001-11-13 09:35:24 from Haller Christoph

Browse pgsql-php by date

  From Date Subject
Next Message Haller Christoph 2001-11-13 09:35:24 Re: Joins!!
Previous Message Edward Smirnov 2001-11-02 06:46:07 PostgresDAC ver.1.8: Delphi/C++Builder BDE replacement

Browse pgsql-sql by date

  From Date Subject
Next Message Otakar Kleps 2001-11-13 08:28:58 Help with RULE
Previous Message Jack Gao 2001-11-13 05:20:44 Is this a bug?