Home » SQL & PL/SQL » SQL & PL/SQL » please suggest a sql statement
please suggest a sql statement [message #314172] Tue, 15 April 2008 23:04 Go to next message
avrillavinge
Messages: 98
Registered: July 2007
Member
Kindly Suggest a sql statement

Hi,

I have a table Account in which Acc_Key is PK.

Acc_co_Num, Acc_Pro_code, Acc_id are composite primary keys.







For each unique combination of Acc_co_Num, Acc_Pro_code, Acc_id should have a unique Acc_Key.

I want to find all Acc_Key which have same combination of Acc_co_Num, Acc_Pro_code, Acc_id.



Please suggest a sql to find all the Acc-Key as in the snapshot.





i tried this :select a.Acc_key from
account a INNER JOIN account b on (A.Acc_co_num = B.Acc_co_num and a.acc_pro_code = b.acc_pro_code and a.acc_id = b. acc_id)

doesnt work pls help ..
Re: please suggest a sql statement [message #314173 is a reply to message #314172] Tue, 15 April 2008 23:07 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/t/88153/0/
It appears you have not read or 100% totally ignored the posting guidelines at stated above.

>doesnt work pls help ..
my car doesn;t work.
please tell me how to make my car go.

You FIRST!
You answer my problem, then I'll solve yours.
Re: please suggest a sql statement [message #314205 is a reply to message #314172] Wed, 16 April 2008 01:27 Go to previous message
MarcS
Messages: 312
Registered: March 2007
Location: Antwerp
Senior Member
@ anacedent : guess it's time to buy a new car, the number of times you said it's not working is rather worrying Laughing


@ avrillavinge: please post the CREATE TABLE statement of the ACCOUNT-table. Don't forget to add all constraints created for that table as well.
(Oh, and don't forget to proper format your post, there is a good guideline around)
Previous Topic: Incorrect Max(time value) results returned
Next Topic: ORA-00984: column not allowed here
Goto Forum:
  


Current Time: Sun Dec 08 07:29:31 CST 2024