Home » SQL & PL/SQL » SQL & PL/SQL » Subquery SQL (10g )
Subquery SQL [message #572243] Sat, 08 December 2012 03:28 Go to next message
glmjoy
Messages: 125
Registered: September 2011
Location: KR
Senior Member
Dear All,

I want to display all account Code but i required this account PFKHR01010101010001 to be fixed to have Credit_Amount.


My Structure is

Finance_TRansactions
------------------------------

D_No Char(12);
Account_Code Char(19);
D_Date Date;
DEbit_Amount Number;
Credit_Amount Number;


Select Account_Code ,Document_No Invoice_No,Credit_Amount
from Finance_Transactions F Where Account_Code not in (Select Account_Code from Finance_Transactions FT
Where
F.Account_Code='PFKHR01010101010001'
and
and F.Account_Code = Ft.Account_Code)

its returns eror

ORA-01427: single-row subquery returns more than one row
Re: Subquery SQL [message #572244 is a reply to message #572243] Sat, 08 December 2012 03:41 Go to previous messageGo to next message
Littlefoot
Messages: 19901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I don't know what you want to get as a result (didn't understand the question), but I doubt that query you posted is capable of returning the TOO-MANY-ROWS error.

I prefer properly asked questions, the ones that contain test case, queries properly formatted and anything else that makes a problem clear. Could you do that?
Re: Subquery SQL [message #572245 is a reply to message #572243] Sat, 08 December 2012 03:42 Go to previous messageGo to next message
Michel Cadot
Messages: 60063
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
It is not possible to have this error with this query.

Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version, with 4 decimals.

Use SQL*Plus and copy and paste your session, the WHOLE session.

Regards
Michel
Re: Subquery SQL [message #572246 is a reply to message #572243] Sat, 08 December 2012 03:44 Go to previous messageGo to next message
Michel Cadot
Messages: 60063
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
In addition, from your previous topics:

Michel Cadot wrote on Sat, 14 April 2012 10:09
...
Reminder of your previous topics:

cookiemonster wrote on Thu, 12 April 2012 09:35
Please read and follow How to use [code] tags and make your code easier to read?
...


Michel Cadot wrote on Thu, 12 April 2012 09:50
Quote:
...Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.

Use SQL*Plus and copy and paste your session, the WHOLE session.
...


Michel Cadot wrote on Mon, 30 January 2012 12:19
Michel Cadot wrote on Mon, 30 January 2012 11:57
Post a working Test case: create table and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.

Before, Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version, with 4 decimals.
...



Regards
Michel


[Updated on: Sat, 08 December 2012 03:45]

Report message to a moderator

Re: Subquery SQL [message #572276 is a reply to message #572244] Sun, 09 December 2012 23:22 Go to previous messageGo to next message
glmjoy
Messages: 125
Registered: September 2011
Location: KR
Senior Member
In one column which is amount i want that amount is fixed which comes against fixed code PFKHR01010101010001. But I want to display all codes too but I dont want to display fixed Code which i mention .

I want my result
Credit Amount Account Code
3000
PFKHR01010101010002
PFKHR01010101010003
PFKHR01010101010004

I hope it is clear.

Regards,

glmjoy
Re: Subquery SQL [message #572277 is a reply to message #572276] Sun, 09 December 2012 23:34 Go to previous message
BlackSwan
Messages: 23189
Registered: January 2009
Senior Member
willfully refuses to comply with Posting Guidelines & deserves to be added to every IGNORE list
Previous Topic: How to add a sequence column to an existing table with records
Next Topic: CLOB to Table
Goto Forum:
  


Current Time: Sat Dec 27 18:26:23 CST 2014

Total time taken to generate the page: 0.12431 seconds