Re: Advise with a select statement

From: Sachin Srivastava <sachin(dot)srivastava(at)enterprisedb(dot)com>
To: JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Advise with a select statement
Date: 2011-04-21 17:50:58
Message-ID: CE9B9481-67A3-4AD5-A0FA-C265308B3493@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

A naive and simple solution is: (Let the table name is table1)
SELECT a.Team, a.Score FROM table1 a, table1 b WHERE a.Score = b. Score and a.Team != b.Team;

On Apr 21, 2011, at 10:35 PM, JORGE MALDONADO wrote:

> If I have a table that has a column where values can be the same, how can I SELECT them?
> For example, consider the following table:
>
> --------------------------------------
> Team Score
> --------------------------------------
> T1 500
> T2 510
> T3 505
> T4 499
> T5 500
> T6 508
> T7 505
> T8 498
> T9 501
>
> As you can see, T1 and T5 have a score of 500; and T3 and T7 have a score of 505. What I want is a SELECT to get only these four records.
>
> Respectfully,
> Jorge Maldonado

--
Regards,
Sachin Srivastava
EnterpriseDB, the Enterprise PostgreSQL company.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Lew 2011-04-21 18:10:29 Re: Choosing character set for database
Previous Message JORGE MALDONADO 2011-04-21 17:05:30 Advise with a select statement