troubleshooting Question

Need to output two records that are next to each other in a table that meet a criteria

Avatar of frogman22
frogman22 asked on
Microsoft SQL Server 2005
14 Comments1 Solution290 ViewsLast Modified:
Operating enviroment is sql server 2005.

I have a 100,000 record table that is sorted ascending based on memo_id.  I need a query that will always find two records next to each other in ascending order that have the following criteria:
TEST 1
operator_id in first row is ALWAYS different than operator_id in NEXT row. If TRUE-----
TEST 2
memo_system_txt in first record will ALWAYS start with 'Order DM14% ' AND
memo_system_txt in NEXT record will ALWAYS start with 'QA Order DM14% ' If TRUE Show Data

memo_id              operator_id      memo_type      memo_system_txt
9606209193           326978      OR01      Order DM14 - O - 16354183 was created
9619571765      598755      OR02      QA Order DM14 - O - 16354183 was approved

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 14 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros