a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Hosting from $3.99 per month!

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions. dd

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

HELP ME PLEASE ! :( At most one record can be returned by this subquery

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> HELP ME PLEASE ! :( At most one record can be returned by this subquery
Page: [1]
 
Mr Me

 

Posts: 4
Joined: 11/14/2004
Status: offline

 
HELP ME PLEASE ! :( At most one record can be returned... - 11/23/2004 16:33:38   
Select DISTINCT name, workcode
FROM Staff Where
(
(name <> (select distinct Name from Manager))
AND
(workCode <> (select distinct code from Manager)) )

OR

( (name = (select name from manager))
AND
(workCode <> (select code from manager))
)
Mr Me

 

Posts: 4
Joined: 11/14/2004
Status: offline

 
RE: HELP ME PLEASE ! :( At most one record can be retu... - 11/23/2004 16:34:14   
I dont know what to do. Why does it say that ?

At most one record can be returned by this subquery

(in reply to Mr Me)
Reierm

 

Posts: 2
Joined: 3/7/2006
Status: offline

 
RE: HELP ME PLEASE ! :( At most one record can be retu... - 3/7/2006 17:34:11   
I know this is like two years old, but it's the top search result in Yahoo when searching this error message, so I figure some form of response might be helpful to someone down the line.

At any rate....that message means that even though you think you're returning only one record in your subquery, for some reason you're getting more than one. A good way to test this is to take your subquery and run it by itself. This will show you what data you are passing back to the main query. If you're passing more than one record back, that's why you get the error message.

What you might try is comparing "Name" to a collection, similar to the following -

Select DISTINCT name, workcode 
FROM Staff Where 
( 
(name NOT IN (select distinct Name from Manager)) 
AND 
(workCode NOT IN (select distinct code from Manager)) )

I haven't tested this, but I'm pretty sure that would do what you're trying to accomplish.

< Message edited by Reierm -- 3/7/2006 18:02:57 >

(in reply to Mr Me)
jeffmetcalf

 

Posts: 186
Joined: 3/16/2002
From:
Status: offline

 
RE: HELP ME PLEASE ! :( At most one record can be retu... - 3/7/2006 20:49:09   
Your subqueries could return more than one result. Using Distinct won't filter the results as you'd expect, but because your subs are asking 2 questions, where name = and where name <>, both of which ask about the work code, you'd possibly get more results than expected.

I'd have to see the table structures to help more....and I'd also use an inner join to join the staff to the managers table to start, and go from there.

(in reply to Reierm)
Reierm

 

Posts: 2
Joined: 3/7/2006
Status: offline

 
RE: HELP ME PLEASE ! :( At most one record can be retu... - 3/8/2006 16:23:59   

quote:

ORIGINAL: jeffmetcalf

Your subqueries could return more than one result. Using Distinct won't filter the results as you'd expect, but because your subs are asking 2 questions, where name = and where name <>, both of which ask about the work code, you'd possibly get more results than expected.

I'd have to see the table structures to help more....and I'd also use an inner join to join the staff to the managers table to start, and go from there.


You've been waiting two years to prove me wrong, haven't you?

:)

(in reply to jeffmetcalf)
jeffmetcalf

 

Posts: 186
Joined: 3/16/2002
From:
Status: offline

 
RE: HELP ME PLEASE ! :( At most one record can be retu... - 3/9/2006 8:52:41   
Nah...just written enough bad queries with the same results.

(in reply to Reierm)
Page:   [1]
OutFront Discoveries

All Forums >> Web Development >> ASP and Database >> HELP ME PLEASE ! :( At most one record can be returned by this subquery
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts