Get your CodeRanch badge!*
The moose likes JDBC and the fly likes subquery in transact sql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "subquery in transact sql" Watch "subquery in transact sql" New topic
Author

subquery in transact sql

Archanaa Panchal
Greenhorn

Joined: Sep 22, 2004
Posts: 7
hi all,

ok..ere's what the problem is. i am using a subquery to select multiple rows in a table, take a specific field out of them, and sum them up, and return the result (which should be one float value) to a field in a temp table in a stored proc.

when i run the subquery by itself, using the same constraints and the same generic table, it does return only one value for each field. but when i try to put the query as a subquery and assign its result to the specific column in my temp table, i get an error saying
"cannot assign result to var since subquery returned more than one value"

its taken me 4 days to just get my basic code going - and i spent all of today staring at this without any luck. ive tried everything...nothing works!!

help!!
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

show the query.

I guess the subquery isn't bound to the outer query correctly.


http://home.arcor.de/hirnstrom/bewerbung
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29287
    
140

Archanaa,
Can you post your query?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: subquery in transact sql
 
Similar Threads
Date Displaying issue
passing on values from method to method
Stored Procedure Issue
Finding Duplicate Records
Unable to get the chackbox array values in Servlet file