Click here to Skip to main content
15,890,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
SELECT PageAuthentication.PageName,PageAuthentication.Page_ID,
(Select PageAuthentication.PageName from PageAuthentication where PageAuthentication.Page_ID in(282,209))
 as Headers  FROM
 PageAuthentication INNER JOIN PageUserAuthorization ON
 PageAuthentication.Page_ID = PageUserAuthorization.Page_ID WHERE
  PageUserAuthorization.Type_ID = 'TA1' and
  PageAuthentication.PageParent_ID in (282,209)



above code giv an error.please correct my query...
Posted
Updated 16-Mar-12 20:56pm
v2
Comments
Ganesan Senthilvel 17-Mar-12 2:55am    
Have you tried 'distinct' in select query?
Ravi shekahr 17-Mar-12 2:58am    
when i used distinct it gives same error.
Ravi shekahr 17-Mar-12 3:01am    
Plase Someone help me....Please
Herman<T>.Instance 17-Mar-12 3:50am    
what do you expect from this query as result?

1 solution

The problem is that your subquery will return more than one value - or it could - and it is in a position where SQL can only accept a single value per row - not a variable number of values. Effectively, what your query is asking for is SQL to return a tree structure, rather than a flat row based structure.

id   Headers
1    Joe
     Mike
     Dave
2    Joe
     Sue
3    Dave
SQL is saying it can't do that.

What are you trying to achive that you think this is a solution?
 
Share this answer
 
Comments
Ravi shekahr 17-Mar-12 4:15am    
what kind of correction should i do.?
OriginalGriff 17-Mar-12 4:48am    
As I said: what are you trying to get?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900