How to Group discontinued time periods

Hi All:
I have an issue which costs me bunch of time to develop. Basically I am trying to use discounted time in a select query but feel  like get nowhere to start.
the scenarios is like this:
I have many rows of data of this and I would like to have a solution I can select time period from just like what I can do for integer and text:
Select *
From Table
Where Group = B
and Open_Date in (select the all group A's time interval)
to explain this problem in plain text, I would like to select all records from Group B whose Open_Date is within the interval between Group A's Open_Date and Close_Date. Thanks all in advance.
Record
Open_Date
Close_Date
GROUP
1
9/12/2013 9:25
9/12/2013 10:44
A
2
9/12/2013 10:19
9/12/2013 10:39
A
3
9/12/2013 10:22
9/12/2013 10:22
A
4
9/12/2013 10:56
9/12/2013 12:41
B
5
9/12/2013 12:00
9/12/2013 12:00
B
6
9/12/2013 12:00
9/12/2013 12:01
A
7
A+E301:H318
9/12/2013 12:03
A
8
9/12/2013 13:44
9/12/2013 13:46
C
9
9/12/2013 13:46
9/12/2013 13:46
C
10
9/12/2013 13:46
9/12/2013 14:33
C
11
9/12/2013 14:04
9/12/2013 14:09
A
12
9/12/2013 14:23
9/12/2013 17:05
A
13
9/12/2013 15:54
9/12/2013 15:54
A
14
9/12/2013 15:54
9/12/2013 15:55
B
15
9/12/2013 15:55
9/12/2013 15:55
B
16
9/12/2013 15:55
9/12/2013 15:58
A
17
9/12/2013 16:02
9/12/2013 16:02
A

Sorry cannot test it right now
Select *
From Table
Where Group = B
AND Open_Date in (SELECT OpenDate FROM Table WHERE  Group = A
AND  OpenDate  BETWEEN OpenDate  AND CloseDate )
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence

Similar Messages

  • Q10 how do I definethe time period in which my emails are kept on my smartphone

    Q10  how do I definethe time period in which my emails are kept on my smartphone,  30 days, 60 days, 90 days  forever etc...

    I am confused..."Advanced Options" is not there? Or inside of Advanced Options, "Sync Timeframe" is not there?
    I'm sorry but I don't have any POP integrated accounts (gave up on POP years ago, IMAP and ActiveSync are so much more powerful), so I can't compare specifically for you. It may possibly be called "Days to Synchronize", and may possibly be elsewhere in the Account screens for that specific account.
    Or, indeed, it just may not exist as an available setting for POP.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • How to increase the time period in Debugger

    Hi,
    If we put Debugging screen Idle for some time,we will get timed out Status bar message.Can we increase that time period.

    hi,
    A work process which is processing your task is set into a DEBUG mode.
    Debugging in general does requesting a huge memory consumption and system resources as well.
    This means that system is moving data to its extended memory in PRIV mode.
    In this mode normal request being processed by other work processes are located in local memory instead of extended. Extended memory is occupied by data for debugging user exclusively. However this cannot persist in system for a long time. So since you are not active in debugging session for some time system is canceling whole debugging with following messages:
    1) Transaction from "PRIV" session reset after timeout (Message no. 14048)
    2) Transaction from "DEBUG" mode (after timeout) reset (Message no. 14056)
    From basis point of view for production system there should not be a necessity to adjust profile parameters in order to allow debugging for a long time and for a so much users. If you wish to avoid this message anyway or you want to make debugging more comfortable on development or test system you need to consider following profile parameters:
    1)rdisp/max_priv_time # Standard value: 600
    2)rdisp/wppriv_max_no # Standard value: MAX(1, Anzahl Dialog-WPs)
    3)rdisp/max_debug_lazy_time # Standard value: 600
    thanks and regards
    chinnaiya

  • How to specify two time periods in data manager

    Hi
    How to configure a data manager where in I have to provide option of coping INR data from last year period to the current year.
    Note:- Users do not want to use copy package as we have to run logic for only few accounts
    Regards
    Edited by: Rohit26 on Sep 24, 2011 9:36 AM
    Edited by: Rohit26 on Sep 24, 2011 9:36 AM

    I think that PROMPT SELECTINPUT should be able to do what you need: have 2 selections of same Dimension in one Package. Take a look at example given in the documentation [http://help.sap.com/saphelp_bpc75_nw/helpdata/en/e9/23ece2cfd7489f8aa457d78d306a38/frameset.htm].
    Let us know if this is not what you are looking for.
    Gersh

  • Report workload by calculating how many versions of SharePoint list items created in a certain time period

    I have a total of 66 SharePoint 2010 lists - yes, 66! - each lists contains between 1500 and 3200 list items.  My employees update these various list items throughout their workday.  Each update to a list item creates a new version of the list
    item.  On average each list item will have anywhere from 5 to 10 versions before it is done.  I need to create a report that tells me how many list items they've updated in a certain time frame.  I have come close but still cannot arrive at
    the data I'm looking for. 
    This is what I have so far:
    I've created a report using SQL Report Builder 2008 v3 where I've filtered it to show only items MODIFIED between, for example, Feb1 and Feb28.  Of those records, I want the report to tell me how many versions were created during that time
    frame.  The result is one list item with 5 total versions.  Versions 1.0, 2.0, & 3.0 were created on 12/12/14.  The last two versions, 4.0 and 5.0, were created on 2/24/15.  Therefore, the answer I'm looking for is 2 because they
    created 2 versions between Feb1 and Feb28.
    However I get the following results using these queries:
    If I do a =Sum(Fields!owshiddenversion.Value) in the expression field I get the total versions which is 5
    If I do a =Count(Fields!owshiddenversion.Value) in the expression field I get the instance which is 1
    Is there a way to count ONLY the number of versions created in a time period?  Is there another hidden field in SharePoint that I can use in the expression that will give me results I'm looking for?

    Hi Rafael70,
    Per my understanding that you have already get all the need fields and informaiton of the updated version of list items and now you want to calculate how many versions of SharePoint list items created in a certain time period, you can't get desired result
    using sum and count function, right?
    I have tried to tested on my local environment but because I am not clear what is value in the field "owshiddenversion", I assumed you have two datatype parameters (StartDate and EndDate) to help filter the report in a certain time period.
    Generally, if you have add the filter correctly, it will filter the correct number's updated version in this time period, I would like you to provide details information as below to help better analysis the requirements:
    Could you please provide sample data of the table.
    Please provide snapshot of the report structure you have currently designed.
    Please try to provide all the expression you have used.
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • How do you set the time period on IMAP email accounts (razr maxx)

    Hi Guys -
    Does anyone know how you can set the time period that the stock email will keep the already downloaded messages for IMAP email accounts?
    Mine never seems to show more than a couple of days worth at a time. I'd ideally like to be able to see at least 2 weeks worth of messages without needing to download them again!
    On other phones I've had there was a setting in the menu, but either I can't find it...or it's not there. I've found the setting for how OFTEN it checks the accounts, but not the setting I am seeking.
    Your help is appreciated!
    Best Wishes for the Holiday Season.
    -Rich

    Hey Rich.  Once in 'settings,' there should be a "days to sync' under the 'data usage' section.   You don't have that?

  • How to find out the rows inserted between a time period.

    Hi,
    Please help me to solve this.
    Table - emp.
    Colmns - empno(Primary Key),ename, mgr
    How to find out the rows inserted between a time period.
    For eg:- Between 02-Oct-2006 1 PM and 03-Oct-2006 2 PM.
    regards,
    Mathew.

    Hi,
    Maybe work:
    For each row, ORA_ROWSCN returns the conservative upper bound system change number (SCN) of the most recent change to the row. This pseudocolumn is useful for determining approximately when a row was last updated. It is not absolutely precise, because Oracle tracks SCNs by transaction committed for the block in which the row resides
    e.g.:
    SGMS@ORACLE10> create table test(cod number);
    Table created.
    SGMS@ORACLE10> insert into test values (1);
    1 row created.
    SGMS@ORACLE10> insert into test values (2);
    1 row created.
    SGMS@ORACLE10> commit;
    Commit complete.
    SGMS@ORACLE10> insert into test values (3);
    1 row created.
    SGMS@ORACLE10> commit;
    Commit complete.
    SGMS@ORACLE10> select SCN_TO_TIMESTAMP(ora_rowscn),ora_rowscn,cod from test;
    SCN_TO_TIMESTAMP(ORA_ROWSCN)       ORA_ROWSCN        COD
    06/11/06 08:56:56,000000000         727707205          1
    06/11/06 08:56:56,000000000         727707205          2
    06/11/06 08:57:05,000000000         727707210          3Cheers

  • How to generate n random dates between 2 time periods

    Hi,
    I'm trying to write a method that generates n random dates between 2
    time periods. For example, lets say I want to generate n random dates
    between Jan 1 2003 and Jan 15 2003. I'm not sure how to go about
    doing the random date generation. Can someone provide some direction
    on how to do this?
    The method signature should look like this.
    public String[] generateRandomDates(String date1,String date2,int n){
    // date1 and date2 come in the format of mmddyyyyhh24miss.
    // n is the number of random dates to generate.
    return dateArray;
    Thanks.
    Peter

    first take a look at the API concerning a source of randomness (Random might be a good guess), then take a look at stuff concerning dates (Date might be cool, maybe you will find some links from there).
    Who wrote this stupid assignment?

  • How to compare data from 2 different time periods

    Hi folks,
    I have a question on approach to a problem. I want to be able to compare data from a common db, but for 2 different time periods. For example I want to see the number of occurences of an instance in my data for today and compare it against occurences a week ago today. What's the best approach for this kind of problem? Is this done with 2 separate queries from 2 sub reports and then compared some how? Any comments on this approach or an other are appreciated.
    TIA bvd

    Follow these steps:
    1) Bring your first time period in your main report.  This will be your first query.
    2) Bring your second time period in a subreport.  This will be your second query.
    3) Bring the values from your subreport into your main report using shared variables.
    4) Lastly, compare the results using formulas in your main report.
    I hope this information proves useful.
    Regards,
    Zack H.

  • HT2486 How can you put same contact in a Group multiple times so that you can print the same mailing label multiple times?

    How can you put same contact in a Group multiple times so that you can print the same mailing label multiple times?

    Hello,
    Avery...
    https://discussions.apple.com/thread/2588943?start=0&tstart=0
    Or...
    http://www.belightsoft.com/products/labelsaddresses/overview.php

  • I have been having issues with my iCloud email on my iMac. For some time period, everyday, it won't reload and often shows symbols instead of letters for the text. Any ideas how to solve?

    I have been having issues with my iCloud email on my iMac. For some time period, everyday, it won't reload and often shows symbols instead of letters for the text. Any ideas how to solve?

    All I can suggest is that you open that file on the MBA and save it as a new file, then see if you can open the new one on the iMac.

  • HT4914 How long is the $24.99 subscription period for iTunes Match, nowhere does it show the time period?  Week, month year?

    How long is the $24.99 subscription period for iTunes Match, nowhere does it show the time period?  Week, month year?

    It's an annual amount - it's at the top of that page :
    iTunes Match requires an annual subscription fee of $24.99

  • How to find max(time) from table using group by

    how to find max(time) from table using group by
    select var max(time)
              from table
              into (var1, time1)
               where .....
                 group by var.
    it is fetching record which is top in table.
    if u can help?
    regards.

    No this will fetch the maximum time from teh table.
    select var max(time)
    from table xxxx
    into (var1, time1)
    where .....
    group by var.
    Refer this code
    TABLES SBOOK.
    DATA:  COUNT TYPE I, SUM TYPE P DECIMALS 2, AVG TYPE F.
    DATA:  CONNID LIKE SBOOK-CONNID.
    SELECT CONNID COUNT( * ) SUM( LUGGWEIGHT ) AVG( LUGGWEIGHT )
           INTO (CONNID, COUNT, SUM, AVG)
           FROM SBOOK
           WHERE
             CARRID   = 'LH '      AND
             FLDATE   = '19950228'
           GROUP BY CONNID.
      WRITE: / CONNID, COUNT, SUM, AVG.
    ENDSELECT.

  • How to display the color of time period and the legend in Calendar view?

    Hi,
    Sorry to disturb you guys with a quite simple question.
    I want to do a calendar view to display the period of absence for the portal user. I've setup the iView but it displays neither the color of time period nor the legend.
    The problem is:
    1) If I test with <i>static legend</i> (that is, I input the time period directly in the form instead of using data service),
       a) I could only define <b>one</b> time period, because it's impossible to map the <i>out</i> port of calendar to <i>in</i> port of form on defining the event as 'goto'.
       b) I can't see the color displayd while deploying although there is just one time period! Neither the legend. I' ve given the label and color of the legend and assigned the action as default in design board. Why it doesn't work?
    2) If I test with <i>dynamic legend</i> following the chapter "<i>Display Date on a Calendar</i>" in the <i>Modeler's Guide</i> of VC;
        I assigned @RECORDNR to 'ID legend field', and used BAPI_ABSENCE_GETLIST as dynamic legend data service to edit the legend, and assigned the color for every ID. But neither color nor legend could kindly appear. What's the problem? Is there any error in the edit of entry list of the legend?
    Please help me! Thanks!!!

    Is there any advice?
    I'll greatly appreciate your help!

  • How to disable an alert for specific time period in SCOM 2012 R2

    Hello,
    Is there any option to disable an alert for specific time period in SCOM 2012 R2
    Regards,
    angs

    No. But you can use the scheduler module in your rule or monitor, which will dictate when the workflow will actively run on the agent - hence disabling alerting for that time period.
    http://msdn.microsoft.com/en-us/library/ff453828.aspx
    Jonathan Almquist | SCOMskills, LLC (http://scomskills.com)

Maybe you are looking for

  • Unable to mail-enable a document library when using Directory Management Service in SharePoint 2013

    I'm not able to mail-enable a library document while Directory Management Service is enabled. This behavior only happens when Directory Management Service is turned on. Correlation ID: a8c7b29c-d193-90b5-ae14-64cd1143445f Note that I have the OU crea

  • Making hypertext work if things are NOT in the same folder?

    I am writing a large doc with FM (FM 8.0p277), several appendix files, 100+pages, etc. I am using hypertext to link external PNG images with the document. This is working just fine (message openfile:filename.ext). Then, I print as PDF doc, and still

  • Housing is broken by headphone jack input

    Hi there! I bought a 16gb iPod Nano (7th Gen) less than a year ago. This is the third iPod that I've owned and have never had an issue. Until this one. The housing by the headphone jack input has broken. Can anyone here give me insight on what I need

  • HT4623 Iphone cannot be restored, error -1

    I've tried everything. Any suggestions? Anyone else having this problem? I can't even use my phone at this point.

  • OK to Disconnect??????

    I just got my 4th IPOD (A Nano 1gb this time) and when I plug it into the Computer it acts as if it is updating then promptly states "OK to Disconnect" What is going on? The only thing that I can tell I did was "Enable Disk Space" I Un-Checked this o