Advertisement

05.15.2008 at 04:41AM PDT, ID: 23404638
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.5

Query to find missing sequence numbers

Asked by tomsj188 in SQL Server 2005

Hi Experts

I need some help writing a t-sql statement.
I have two tabels sentmessages and missingsentmessages,
they both contains three fields, orderid as int, seqno as int and createdate as datetime.
the seqno column is an integer ranging from 0 to 4095 starting over when it reaches 4095,
orderid is a reference to an order table and createdate is the date the row was created.

The seqno comes from cars sending in orders, and sometimes they get lost on the way, giving me holes in the sequence.
So what i want to do is create a query that get all the missing seqnos for a month and i also needs the date from the biggest lower number in that sequence.
this needs to be done given a spcific orderid.

An example
sentmessages:
orderid      seqno      createdate
1      12      2008-05-12 13:25:03.008
1      10      2008-05-12 13:25:02.194
1      9      2008-05-12 13:25:01.012
1      8      2008-05-12 13:24:55.023
1      5      2008-05-12 13:24:58.389
1      2      2008-05-12 13:23:53.117
1      1      2008-05-12 13:23:52.563
1      0      2008-05-12 13:23:49.956

missingsentmessages:
orderid      seqno      createdate
1      7      2008-05-12 13:25:03.008




Given that, the answear i want is this
orderid      seqno      createdate
1      11      2008-05-12 13:25:02.194
1      6      2008-05-12 13:24:58.389
1      4      2008-05-12 13:23:53.117
1      3      2008-05-12 13:23:53.117


This needs to be done with a very fast query, to build a iterative method for this is no good, and i can do it my self. :)

Also take in consideration that the seqno field starts over after 4095, mening that it could look lite this:
2
1
4095
4093

then the answear should be 0, and 4094


thanx
/Tomas Start Free Trial
[+][-]05.15.2008 at 06:46AM PDT, ID: 21573544

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 07:53AM PDT, ID: 21574287

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 07:57AM PDT, ID: 21574331

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.16.2008 at 12:29AM PDT, ID: 21580609

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.16.2008 at 07:22AM PDT, ID: 21582954

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.17.2008 at 08:09AM PDT, ID: 21589625

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.17.2008 at 08:17AM PDT, ID: 21589656

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 03:26AM PDT, ID: 21596390

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 05:39AM PDT, ID: 21597187

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 07:24AM PDT, ID: 21598034

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 09:28AM PDT, ID: 21599232

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 09:37AM PDT, ID: 21599317

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.19.2008 at 09:39AM PDT, ID: 21599347

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.19.2008 at 11:28AM PDT, ID: 21600250

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: SQL Server 2005
Sign Up Now!
Solution Provided By: aaronakin
Participating Experts: 2
Solution Grade: A
 
 
[+][-]05.29.2008 at 03:49AM PDT, ID: 21667797

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628