Home » SQL & PL/SQL » SQL & PL/SQL » Is this possible?
Is this possible? [message #356394] Thu, 30 October 2008 10:56 Go to next message
imdreaming
Messages: 11
Registered: April 2008
Junior Member
If this is possible, I'm having trouble with the syntax.

select sum(select field1 from table1) from dual;

There are two rows in table1. Obviously this is to be part of a much larger query.

I'd appreciate respectful advice.

[Updated on: Thu, 30 October 2008 10:58]

Report message to a moderator

Re: Is this possible? [message #356397 is a reply to message #356394] Thu, 30 October 2008 11:08 Go to previous messageGo to next message
fairgame
Messages: 29
Registered: October 2008
Junior Member
why don't you do this..

select (select sum(field1) from table1) from dual;


This is what u want??
Re: Is this possible? [message #356399 is a reply to message #356397] Thu, 30 October 2008 11:10 Go to previous messageGo to next message
imdreaming
Messages: 11
Registered: April 2008
Junior Member
Thank you.

Yeah that works at this point. I'll fold that suggestion back into the big ugly query to see what happens and post back.

I'm pretty certain I tried that at some point and got the dreaded ORA-01427.

Hmm, Now I'm almost certain at this point that I have a Cartesian join problem that is causing the multiple rows to return.

[Updated on: Thu, 30 October 2008 11:13]

Report message to a moderator

Re: Is this possible? [message #356401 is a reply to message #356397] Thu, 30 October 2008 11:14 Go to previous messageGo to next message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
fairgame wrote on Thu, 30 October 2008 17:08
why don't you do this..

select (select sum(field1) from table1) from dual;


This is what u want??

And What is the purpose of dual there?
Just
select sum(field1) from table1


Regards
Michel

Re: Is this possible? [message #356409 is a reply to message #356401] Thu, 30 October 2008 11:32 Go to previous message
imdreaming
Messages: 11
Registered: April 2008
Junior Member
dual is coming from a DBA whose brain has been fried by trying to find the bug in this query for hours and hours.

Previous Topic: problem with sys_refcursor
Next Topic: Query to retrive the number transactions done in every 1 hour for last one month
Goto Forum:
  


Current Time: Fri Dec 02 20:52:28 CST 2016

Total time taken to generate the page: 0.34147 seconds