aspose file tools*
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
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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30938
    
158

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
 
wood burning stoves
 
subject: subquery in transact sql