Link to home
Start Free TrialLog in
Avatar of Bruce Gust
Bruce GustFlag for United States of America

asked on

How can I retrieve these rows?

I have a table that looks like this:

sortorder    statusid   workqueueroleid
1                    NULL          NULL
2                    NULL          NULL
3                    NULL          NULL
4                    30                10
5                    30                10
6                    NULL          NULL
7                    NULL          NULL

What would my select statement look like if I wanted to retrieve all the rows above row #4. In other words, I don't want rows 5, 6 or 7. I only want the rows 1,2 and 3.

How would I do it?
SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@MarqusG: I think LIMIT is a MySQL construct, not MS SQL.  But that aside, if we know the data criteria we can help craft a WHERE clause.  I just have this nagging feeling that the question has some subtext that we cannot find in the literal text.
Oh, I didn't make attention to the topic! But I should... :)
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bruce Gust

ASKER

Guys, as always, thanks for the assistance. I apologize for not staying tuned in. I wound up going with a different approach that involved a nested table and it worked great.

I'll distribute points based on the obvious time and trouble you took to help. Thanks again!