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
Messages: 98
Registered: July 2007
Kindly Suggest a sql statement


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
Messages: 25570
Registered: January 2009
Location: SoCal
Senior Member
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 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
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: question on CURSOR
Next Topic: Explain plan method
Goto Forum:

Current Time: Sat Aug 19 04:27:15 CDT 2017

Total time taken to generate the page: 0.01528 seconds