954,566 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

problem with select within select

Hi

I want to execute below query in ms-sql server 2000 but its giving errors.
Can anybody help please.

select * from ( select vRefTable from mainmenu where iMenuId=58 )
where (select vFieldsName from TableField where iMenuId=58
and bIsPrimary=1 and iTableFieldId=11) = 1


Its showing below errors. your help is greatly appreciated. Server: Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'where'.
Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near '='.

Thanks
Ansari

ansari.wajid
Light Poster
47 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
 

you need to specify what column for the where and the =1 i have no clue what you are wanting there

select * from ( select vRefTable from mainmenu where iMenuId=58 )
where 
-- your column name here
 vFieldsName  in 
(select vFieldsName from TableField where iMenuId=58
and bIsPrimary=1 and iTableFieldId=11)
dickersonka
Veteran Poster
1,175 posts since Aug 2008
Reputation Points: 130
Solved Threads: 143
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You