Solved

Operator '<=' facing multi-value data

Posted on 2009-03-30
3
198 Views
Last Modified: 2012-05-06
I have the following code:

select * from Request_History
where
      Stage_No <= (select Stage_No from Work_Flow where Role_ID='7')

The question is: this (select Stage_No from Work_Flow where Role_ID='7') sometimes return more than one value, then what operator other than the '<=' shall I use in this case?
0
Comment
Question by:alfardan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 38

Expert Comment

by:Jim P.
ID: 24025355
Try this:
select * 
from Request_History
where Stage_No IN (select Stage_No 
                   from Work_Flow 
                   where Role_ID='7')

Open in new window

0
 
LVL 35

Accepted Solution

by:
Terry Woods earned 250 total points
ID: 24025364
Or one of these, depending on the result you want when there's more than one row returned by the subquery:
select * from Request_History
where Stage_No <= (select min(Stage_No) from Work_Flow where Role_ID='7')
 
select * from Request_History
where Stage_No <= (select max(Stage_No) from Work_Flow where Role_ID='7')

Open in new window

0
 
LVL 25

Assisted Solution

by:lwadwell
lwadwell earned 250 total points
ID: 24025368
Hi alfardan,

perhaps you should do

lwadwell
select * from Request_History
where
      Stage_No <= (select max(Stage_No) from Work_Flow where Role_ID='7')

Open in new window

0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question