943,790 Members | Top Members by Rank

Ad:
  • MS SQL Discussion Thread
  • Unsolved
  • Views: 7176
  • MS SQL RSS
Sep 24th, 2008
0

problem with select within select

Expand Post »
Hi

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

MS SQL Syntax (Toggle Plain Text)
  1. SELECT * FROM ( SELECT vRefTable FROM mainmenu WHERE iMenuId=58 )
  2. WHERE (SELECT vFieldsName FROM TableField WHERE iMenuId=58
  3. 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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
ansari.wajid is offline Offline
47 posts
since Aug 2007
Sep 24th, 2008
0

Re: problem with select within select

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

MS SQL Syntax (Toggle Plain Text)
  1.  
  2. SELECT * FROM ( SELECT vRefTable FROM mainmenu WHERE iMenuId=58 )
  3. WHERE
  4. -- your column name here
  5. vFieldsName IN
  6. (SELECT vFieldsName FROM TableField WHERE iMenuId=58
  7. AND bIsPrimary=1 AND iTableFieldId=11)
Reputation Points: 133
Solved Threads: 141
Veteran Poster
dickersonka is offline Offline
1,162 posts
since Aug 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MS SQL Forum Timeline: Matching user preferences
Next Thread in MS SQL Forum Timeline: mssql connection problem with PHP





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC