Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 subquery problem

Author  Topic 

nicky_river
Yak Posting Veteran

55 Posts

Posted - 2010-10-19 : 08:28:22
I m getting an error when i run this query "single row subquery returns more than one row". how do i overcome this or how do i change this query

SELECT MEMBER_CODE TRADING_MEMBER_ID,
(SELECT MEMBER_CLIENT_REFERENCE
FROM LEDGER_ACCOUNTS
WHERE MEMBER_CLIENT_REFERENCE NOT IN (SELECT MEMBER_CLIENT_REFERENCE
FROM CLIENTS
WHERE LEDGER_ACCOUNTS.MEMBER_CODE=CLIENTS.MEMBER_CODE))UNREGISTERED_CLIENT,
TO_CHAR(MIN(DATE_TRADE), 'DD-MM-YYYY') FIRST_DATE_OF_TRADE,
TO_CHAR(SYSDATE, 'DD-MM-YYYY') CURRENT_DATE,
ROUND(SYSDATE - (MIN(DATE_TRADE)))NUMBER_OF_DAYS,
((ROUND(SYSDATE - (MIN(DATE_TRADE))) * 100)) PENALTY_AMOUNT

FROM UN_CLEARED_TRADE_BROKERS
GROUP BY MEMBER_CODE, MEMBER_CLIENT_REFERENCE

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-10-19 : 08:31:22
It is definitely ORACLE.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-10-19 : 08:36:07
www.dbforums.com/oracle



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -