|
| |
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
|
|
|
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
|
|
|
|
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 >
|
|
|
|
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.
|
|
|
|
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.
|
|
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
|
|
|