Desperate for SQL query help!!

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
boroatel
Forum Newbie
Posts: 1
Joined: Tue Oct 21, 2008 8:20 pm

Desperate for SQL query help!!

Post by boroatel »

Hello,

Can any SQL master out there help me with a query? I have the following table:

contract project activity
row1 1000 8000 10
row2 1000 8000 20
row3 1000 8001 10
row4 2000 9000 49
row5 2000 9001 49
row6 3000 9000 79
row7 3000 9000 78

Basically, the query I'm looking for would return "2000,49" for "contract, activity" because only contract #2000 has one, and ONLY one, unique activity value.

I greatly appreciate your help,

Thanks a million in advance,
boroatel
User avatar
novice4eva
Forum Contributor
Posts: 327
Joined: Thu Mar 29, 2007 3:48 am
Location: Nepal

Re: Desperate for SQL query help!!

Post by novice4eva »

Code: Select all

SELECT   creditor_type, entity_type_cd
    FROM all_data_information
GROUP BY creditor_type, entity_type_cd
having count(*)=1
 
Post Reply