how to find gap in a range.

rkyrky Posts: 1 New member
edited January 12, 2020 7:18AM in General Forum

I use sql 2012 but, one can answer up to 2019

 

create table t ( b decimal(13,4) not null, c decimal(13,4) not null);
Insert into T (B,C) values ( 1,200);
Insert into T (B,C) values (   200   ,400);
Insert into T (B,C) values (  600,   900);

create table t1 (b decimal(13,4) not null, c decimal(13,4) not null);
Insert into t1 (B,C) values ( 1,100);
Insert into t1 (B,C) values (  200   ,500);
Insert into t1 (B,C) values (  800,   1000);

-- "t" and "t1" table holds ranges which could be any thing where b<c, i have to find out where "t" has range but "t1" does not?
--ex "t"  has 1,200 , "t1"  1,100  so i want to see 100 to 200 t2 does not have any thing.

Q) i have to find out the range where "t" has got range but "t1" does not? that means start range and end range will be passed

and i have to find out the range where "t1" is not done but "t" is done

-- case 1 table "t" and "t1" will have no overlap  with in the table

-- case 2 they will have overlap with in the table.

 result 

100 -200

600 - 800

yours sincerley

Answers

  • DerFredoDerFredo Posts: 2 New member
    Off the top of my head, that sounds like a variation of the "gaps and islands" problem. In T-SQL you can use window functions (or other ways) to solve the basic problem, maybe you can extend that approach. Look here, for example: https://www.red-gate.com/simple-talk/sql/t-sql-programming/the-sql-of-gaps-and-islands-in-sequences/
  • johnwilliam23johnwilliam23 USAPosts: 1 New member
    edited April 15, 2020 4:10AM
    You need to identify any ranges not included between 0 and 1. Note that some ranges do overlap. The exclusivity of the endpoints is not relevant for use case; You only need to identify what the endpoints of the gaps.

    Here is the table structure:

    DECLARE @ CheckRegister TABLE
    (
       AccountNumber Varchar(10),
       CheckNumber Varchar(10)
  • Anyone who at least once wrote an essay and term paper himself knows how hard it is to cope with this task. That's why we've created a really working guide https://papernow.org/college-papers for you to help you with this task.
  • CollinsCollins Posts: 1 New member
    We will help you, wherever you study, at the university or in college. Certified specialists will perform work of any difficulty and of any volume https://grademiners.com/ the main thing is to ask about it, so do not waste your chance and use their services, they are waiting for you!
  • I am an essay writer and currently working with an online essay writing service Essaywriting. Your all kind of write my essay requests will entertain here fast by expert writers.
    https://essayswriting.org/
  • Chante89Chante89 Posts: 1 New member
    Hello everybody! I recently started developing my business and discovered a service that helps to hire a qualified team for any development, and you can find more here, because the world changes have made it big in the market over the past few years. There is a need for mobile applications in the market, and therefore more and more companies are taking advantage of the platform. Good luck!
  • This is really a good source of information, I will often follow it to know more information and expand my knowledge, I think everyone should know it, thanks

    Visit Here :- Essay writer bot

    Looking for a Online essay writer, then your search is ended here. Visit myessaywriter.net to get the best paper writing service for yourself. We specialize in research paper writing, thesis writing, and project paper writing. Hire the best to write my paper for me at essaywriter.net. We provide PowerPoint presentations service also. Please visit myessaywriter.net for more information.

  • PippaChapmanPippaChapman Posts: 1 New member
    edited February 26, 2021 5:35PM
    Thx you john for your answer!!
  • TonyMerrowTonyMerrow Posts: 2 New member
    This is really a good source of information, I will often follow it to know more information and expand my knowledge, I think everyone should know it, thanks
    https://www.forextime.com/trading-accounts/demo-account
  • Jeff ModenJeff Moden Posts: 7 Bronze 1
    Lordy... the spammers sure had a field day on this one.  ;) 

    DerFredo cited a really good link by Dwain Camps on the subject.  Other than my posts, it's also the only post that has nothing to do with the spam that the others have written.  I'm not even going to mention the subject of the spam the others have written for fear of the damned bots and human moroffs posting more spam.

  • painsadpainsad Posts: 1 New member
    The Friday Night Funkin challenges your rhythm. The game will ask you to press a key at a specific time: the screen will show which key to press and the game will score for both a specific time and a shorter time.
  • Noah_millerNoah_miller Posts: 1 New member
    looking for essay writer at affordable price then visit here and get the best out of it
  • Decent institution - https://qyto.com/. One of the few with no deposit and withdrawal problems. One of the few casinos I've ever played at, with the highest number of live dealer games of any casino.
  • Greenpurdy4Greenpurdy4 Posts: 1 New member

    Cannabis seeds collecting is one of the most rewarding parts of gardening. Not only are you able to take care of yourself by tending to your plants and harvesting the fruits of your labor, but you are also able to preserve the seeds that grow from them. These seeds can be used to create a new crop or to save your favorite varieties for future use.

    As a first step, it's important to understand that not all plant species can produce viable seeds. This includes many types of wildflowers and some vegetables, so be sure to check the label first. In addition, each seed has its own requirements for conditions before it can germinate. Some need cold temperatures, while others prefer warmth in order to develop properly. Make sure you're taking care of these conditions when collecting seeds to increase their chance of success.

    Once you have collected enough seeds for your garden, it's time to start planting them! Take care not to plant them too early as they may rot in the ground before they have a chance to sprout. You should also make sure that they are planted in well-draining soil with good drainage as this will ensure they don't rot in their pots or containers. Once they reach a certain size, you can transplant them into larger containers so they have room to grow into mature plants.


  • LuraJLuraJ Posts: 1 New member
    Exactly What Are The Drawbacks Of Employing A Write My Assignment For Me Assistance?  
    Why could you pay another person to write assignment for me? In this article, you will learn why having to pay other people to accomplish your assignment is really a poor strategy, how to find respected writing service, along with the actions you have to choose to use purchase an educational paper on the internet. So, just what is the drawback of hiring a specialist blogger? Let's explore these issues individually. After you have made the decision no matter if you want to use this services, read on for more information on the methods involved.  
    The easiest method to pick a creating service is by reading its reviews and scores. Most trustworthy writing services supply 100% original content and ensure total privacy of the customers. Additionally they make sure settlement protection and security. Students must pay attention to warranties and evaluations just before selecting an organization. Listed here are some of the benefits and advantages of making use of a writing service. The cost of their services is truly the initially thing that college students look at when deciding on an organization.  
    Go through customer reviews. You may also look at the variety of testimonies posted by earlier clientele. Some reviews will listing all the bad features of a writing service, including value, customer service, and quality. If the testimonials are extremely adverse, then the creating service is probably bogus. Search for critiques that refer to particular areas of the assistance. If the reviews are inexplicable or way too generic, then it might be better to stay away from that particular service.  
    Support service. In case you are concerned about the quality of the service, you are able to ask for longer than one revision. In addition, support service should response your inquiries in just 10 minutes. It is best to discover a creating service which offers a two-way interaction system that can help you interact with your blogger. A buyer-pleasant website makes it simple to contact them and take care of issues. The customer assistance staff ought to be readily available 24 / 7.  
    Trustpilot. Buyer websites like Trustpilot are excellent locations to find true reviews. When these buyer internet sites don't involve each producing support, they can provide you with a good idea of what you should expect. Additionally it is a good idea to study true critiques, since many composing support recommendations are certainly not based upon personal experience. For that reason, there is a reduced level of believe in. But if you're still uncertain, you can travel to some other assessment internet sites to ensure they're not cons.
    Should you don't have plenty of time to examine every producing service, you may not trust their operate. Inspite of the popularity of essay creating providers on the internet, you will find crooks in the market, so you ought to go through an evaluation coming from a third-party to learn when the service is dependable. A trustworthy creating services will have numerous testimonies and critiques. Also, they are ready to provide you with a free of charge sample with their operate.  
    Look into the creating service's writers' credentials. When the writer's qualifications are great, you can be sure they'll offer superior quality reports. Ensure that you examine the plagiarism report to actually don't accidentally version someone's information. When the service doesn't give this, it's greatest to step away from it. If you're proceeding to cover a paper online, you ought to be sure that the services are reliable.  
    There are actually about three simple measures to purchasing a papers online. Initial, pick a papers composing support that provides high quality. Next, complete the transaction form with all the required specifics. Be distinct concerning the educational amount of the papers, the amount of web pages it ought to be, and how many sources are required. Ask for samples of their prior operate if possible. Then, pay money for the document and wait for the article writer to offer it punctually.  
Sign In or Register to comment.