Connecting Tech Pros Worldwide Forums | Help | Site Map

getting error in query..

Newbie
 
Join Date: Jul 2008
Posts: 7
#1: Jul 11 '08
Query gives error : Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression

Query is :
select AlertGroupAssignment.AlertGroupAssignmentID,OPCAle rt.AlertID,OPCServer.OPCServer,OPCItem.OPCItem,OPC Alert.AlertType,OPCAlert.AlertValue,OPCAlert.Sever ity,OPCAlert.Active,OPCAlert.Description from OPCAlert,AlertGroupAssignment,OPCItem,OPCServer where AlertGroupAssignment.AlertGroupID=3 and AlertGroupAssignment.OPCAlertID!=(select OPCAlertID from AlertGroupAssignment where AlertGroupID=1) and OPCAlert.AlertID=AlertGroupAssignment.OPCAlertID and OPCItem.ItemID=AlertGroupAssignment.OPCItemID and OPCServer.ServerID=OPCItem.ServerID or (OPCAlert.Description like 'dgv' or OPCItem.OPCItem like 'dgv' or OPCServer.OPCServer like 'dgv')


I want to return more than 1 value.....Is there any way....

Please help........

deepuv04's Avatar
Expert
 
Join Date: Nov 2007
Posts: 202
#2: Jul 11 '08

re: getting error in query..


Use "NOT IN " instead of " != "

Try the following query

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT    AlertGroupAssignment.AlertGroupAssignmentID,OPCAle rt.AlertID,OPCServer.OPCServer,
  3.         OPCItem.OPCItem,OPC Alert.AlertType,OPCAlert.AlertValue,OPCAlert.Sever ity,OPCAlert.Active,
  4.         OPCAlert.Description 
  5. FROM    OPCAlert,
  6.         AlertGroupAssignment,
  7.         OPCItem,
  8.         OPCServer 
  9. WHERE    AlertGroupAssignment.AlertGroupID=3 and 
  10.         AlertGroupAssignment.OPCAlertID NOT IN(SELECT OPCAlertID FROM AlertGroupAssignment WHERE AlertGroupID=1) and 
  11.         OPCAlert.AlertID=AlertGroupAssignment.OPCAlertID and 
  12.         OPCItem.ItemID=AlertGroupAssignment.OPCItemID and 
  13.         OPCServer.ServerID=OPCItem.ServerID or 
  14.         (OPCAlert.Description like 'dgv' or OPCItem.OPCItem like 'dgv' or OPCServer.OPCServer like 'dgv')
  15.  
Newbie
 
Join Date: Jul 2008
Posts: 7
#3: Jul 11 '08

re: getting error in query..


Thanks Man....I was breaking my head on this silly thing for an Hour....

Thanks again,....
Reply