Refine a query to display only the entries for the current week

Hello.

Anyone know how to change a query to display only those records that have dates of the current week? Records have a start date and an end date, so the query should recognize that the entry may be valid for more than one week?

Kind regards

swelch

Hi Steve,.

I just created a dataset that contained the periods before, during and after the current week - on the assumption that if any day of a range (start/end) falls within the current week so it is included.

In my example this is 'today', June 25, 2011, and a week is defined as Sun - Sat. So my week of 'course' is u 19 June 2011 / I June 25, 2011.

A line any with a start date before or during my 'current' week and an end date that is after or during my "current" week, i.e. no matter what date in its range included in the 'in progress' week will appear.

See you soon,.
Rob

Tags: Database

Similar Questions

  • What are the causes of shell service core to define? Task manager displays only the current process

    When start Windows XP and IE8, a 'coreserviceshell' routine runs for about 10 to 15 minutes, access to the network and really slows access IE, alomost prevents any access ended running.

    Also the TASK MANAGER does not display the menu headers to view the performance of the system, how to reset it?

    Which; good s.

    If running chkdsk /f resolved the problem?  It's the answer that you have marked as the answer...

  • How to write a hierarchical query so that only the child nodes are displayed?

    Hi all

    I have a hierarchical query that I use in an area of tree demand APEX and there are nodes that have no children and I am trying to find a way to not display these nodes. Essentially if the user does not have to develop a lot of knots to know that nothing exists at the most detailed level.

    The data are based on the Oracle Fusion FND tables but for example purposes here is enough data to illustrate my question:


    create table APPL_TAXONOMY_HIERARCHY (SOURCE_MODULE_ID varchar2(30), TARGET_MODULE_ID varchar2(30));
    create table APPL_TAXONOMY_TL (module_id varchar2(30), description varchar2(100), user_module_name varchar2(30), language varchar2(5));
    create table APPL_TAXONOMY (MODULE_ID    varchar2(30),    MODULE_NAME    varchar2(30), MODULE_TYPE varchar2(10),    MODULE_KEY varchar2(30));
    create table TABLES (table_name varchar2(30), module_key varchar2(30));
    
    

    insert into APPL_TAXONOMY_TL values ('1', null, 'Oracle Fusion', 'US' );
    insert into APPL_TAXONOMY_TL values ('2', null, 'Financials', 'US' );
    insert into APPL_TAXONOMY_TL values ('3', null, 'Human Resources', 'US' );
    insert into APPL_TAXONOMY_TL values ('20', null, 'Accounts Payable', 'US' );
    insert into APPL_TAXONOMY_TL values ('10', null, 'General Ledger', 'US' );
    
    insert into APPL_TAXONOMY_HIERARCHY values ('1', 'DDDDDDDD');
    insert into APPL_TAXONOMY_HIERARCHY values ('2', '1');
    insert into APPL_TAXONOMY_HIERARCHY values ('3', '1');
    insert into APPL_TAXONOMY_HIERARCHY values ('4', '1');
    insert into APPL_TAXONOMY_HIERARCHY values ('10', '2');
    insert into APPL_TAXONOMY_HIERARCHY values ('20', '2');
    
    insert into APPL_TAXONOMY values ('1', 'Fusion', 'PROD', 'Fusion');
    insert into APPL_TAXONOMY values ('2', 'Financials', 'FAMILY', 'FIN');
    insert into APPL_TAXONOMY values ('10', 'GL', 'APP', 'GL');
    insert into APPL_TAXONOMY values ('3', 'Human Resources', 'FAMILY', 'HR');
    insert into APPL_TAXONOMY values ('20', 'AP', 'APP', 'AP');
    
    insert into tables values ('GL_JE_SOURCES_TL','GL');
    insert into tables values ('GL_JE_CATEGORIES','GL');
    

    My hierarchical query is as follows:

    with MODULES as
    (
    SELECT h.source_module_id, b.user_module_name, h.target_module_id
          FROM APPL_TAXONOMY_HIERARCHY H,
          APPL_TAXONOMY_TL B,
    APPL_TAXONOMY VL
    where H.source_module_id = b.module_id
    and b.module_id = vl.module_id
    and vl.module_type not in ('PAGE', 'LBA')
    UNION ALL
    select distinct table_name, table_name,  regexp_substr(table_name,'[^_]+',1,1) 
    from TABLES --needed as a link between TABLES and APPL_TAXONOMY
    union all
    select module_key as source_module_id, module_name as user_module_name, module_id as target_module_id  from appl_taxonomy VL where VL.module_type = 'APP')
    SELECT  case when connect_by_isleaf = 1 then 0
                when level = 1             then 1
                else                           -1
           end as status,
    LEVEL,
    user_module_name as title,
    null as icon,
    ltrim(user_module_name, ' ') as value,
    null as tooltip,
    null as link
          FROM MODULES
          START WITH source_module_id = '1'
          CONNECT BY PRIOR source_module_id = target_module_id
    ORDER SIBLINGS BY user_module_name;
    

    In Oracle APEX, this gives a tree with the appropriate data, you can see here:

    https://Apex.Oracle.com/pls/Apex/f?p=32581:29 (username: guest, pw: app_1000);

    The SQL of the query results are:

    STATUSTITLE LEVELVALUE

    ---------- ---------- ------------------------------ ------------------------------

    11 oracle FusionOracle Fusion
    -12 financial tablesFinancials
    -13 accounts payableAccounts payable
    04 APAP
    -1General Accounting 3General Accounting
    -14 GLGL
    05 GL_JE_CATEGORIESGL_JE_CATEGORIES
    05 GL_JE_SOURCES_TLGL_JE_SOURCES_TL
    02 human resourcesHuman resources

    The lowest level is the name of the table to level 5. HR is not any level under level 2, in the same way, "AP" (level 4) has nothing below, i.e. no level 5 and that's why I don't want to show these nodes. Is this possible with the above query?

    Thanks in advance for your suggestions!

    John

    Hello

    The following query will include only the nodes of level = 5 and their ancestors (or descendants):

    WITH modules LIKE

    (

    SELECT h.source_module_id

    b.user_module_name AS the title

    h.target_module_id

    To appl_taxonomy_hierarchy:

    appl_taxonomy_tl b

    appl_taxonomy vl

    WHERE h.source_module_id = b.module_id

    AND b.module_id = vl.module_id

    AND vl.module_type NOT IN ('PAGE', "LBA")

    UNION ALL

    SELECT DISTINCT

    table-name

    table_name

    , REGEXP_SUBSTR (table_name, ' [^ _] +')

    From the tables - required as a link between the TABLES and APPL_TAXONOMY

    UNION ALL

    SELECT module_key AS source_module_id

    AS user_module_name module_name

    module_id AS target_module_id

    Of appl_taxonomy vl

    WHERE vl.module_type = 'APP '.

    )

    connect_by_results AS

    (

    SELECT THE CHECK BOX

    WHEN CONNECT_BY_ISLEAF = 1 THEN 0

    WHEN LEVEL = 1 THEN 1

    OF ANOTHER-1

    The END as status

    LEVEL AS lvl

    title

    -, NULL AS icon

    , LTRIM (title, "") AS the value

    -, NULL as ToolTip

    -, Link AS NULL

    source_module_id

    SYS_CONNECT_BY_PATH (source_module_id - or something unique

    , ' ~' - or anything else that may occur in the unique key

    ) || ' ~' AS the path

    ROWNUM AS sort_key

    Modules

    START WITH source_module_id = '1'

    CONNECT BY PRIOR Source_module_id = target_module_id

    Brothers and SŒURS of ORDER BY title

    )

    SELECT the status, lvl, title, value

    -, icon, tooltip, link

    OF connect_by_results m

    WHEN THERE IS)

    SELECT 1

    OF connect_by_results

    WHERE the lvl = 5

    AND the path AS ' % ~' | m.source_module_id

    || '~%'

    )

    ORDER BY sort_key

    ;

    You may notice that subqueries modules and the connect_by_results are essentially what you've posted originally.  What was the main request is now called connect_by_results, and it has a couple of additional columns that are necessary in the new main request or the EXISTS subquery.

    However, I am suspicious of the 'magic number' 5.  Could you have a situation where the sheets you are interested in can be a different levels (for example, some level = 5 and then some, into another branch of the tree, at the LEVEL = 6, or 7 or 4)?  If so, post an example.  You have need of a Query of Yo-Yo, where you do a bottom-up CONNECT BY query to get the universe of interest, and then make a descendant CONNECT BY query on this set of results.

  • Refine a query to return only one day in the current week

    Hello again,

    Sorry, I thought I could work this given my previous help on the forum but I can't.

    What I do now is to look at the date ranges of records and display which of them are active on a given day of the current week. So for the week beginning June 27, 2011, a Monday, I need to see the records that are present on that day. The same thing on Tuesday, sea, game, Fri.

    Any ideas?


    Kind regards

    Steve Welch

    Hi Steve,.
    No doubt there is a way more elegant to do, but based on my previous post example...

    SELECT TO_CHAR (begin_date, 'DD-Mon-YYYY HH24:MI:SS') AS begin_date,
    TO_CHAR (end_date, 'DD-Mon-YYYY HH24:MI:SS') AS end_date,
    CASE WHEN TRUNC(begin_date) NEXT_DAY (TRUNC (SYSDATE) - 1, 'Sat') - 7 THEN 'X' END AS "Sun",
    CASE WHEN TRUNC(begin_date) NEXT_DAY (TRUNC (SYSDATE) - 1, 'Sat') - 6 THEN 'X' END AS "Mon",
    CASE WHEN TRUNC(begin_date) NEXT_DAY (TRUNC (SYSDATE) - 1, 'Sat') - 5 THEN 'X' END AS "Tue",
    CASE WHEN TRUNC(begin_date) NEXT_DAY (TRUNC (SYSDATE) - 1, 'Sat') - 4 THEN 'X' END AS "Wed",
    CASE WHEN TRUNC(begin_date) NEXT_DAY (TRUNC (SYSDATE) - 1, 'Sat') - 3 THEN 'X' END AS "Thu",
    CASE WHEN TRUNC(begin_date) NEXT_DAY (TRUNC (SYSDATE) - 1, 'Sat') - 2 THEN 'X' END AS "Fri",
    CASE WHEN TRUNC(begin_date) NEXT_DAY (TRUNC (SYSDATE) - 1, 'Sat') -1 THEN 'X' END AS "Sat"
    FROM mydates
    WHERE TRUNC (begin_date) < NEXT_DAY (TRUNC (SYSDATE) - 1, 'Sat') + 1
    AND TRUNC (end_date) > NEXT_DAY (TRUNC (SYSDATE) - 1, 'Sat') - 7
    ORDER BY begin_date 
    

    would give

    BEGIN_DATE end_date Mon Mar sea game Fri Sat Sun
    June 15, 2011 06:48:29 June 25, 2011 06:48:29 X X X X X X X
    June 25, 2011 06:47:57 July 5, 2011 06:47:57 X

    See you soon,.
    Rob

    Published by: Robert Chalton on June 25, 2011 10:31

  • How can I display only the music downloaded to my phone

    My phone displays all the music in my library and not only the songs downloaded on my phone.  I've looked everywhere and the option to display only the songs in my iPhone seems to have disappeared.

    Click the Middle drop-down menu that says artists or Albums etc, and then select only downloaded music.

  • Search bar displays only the icon. How to make it back to normal?

    Search bar displays only the icon. How to make it back to normal?

    Normally, the search bar looks like the photo in this link.

    http://www.SimpleHelp.NET/images/googlesearchicon/img03.jpg

    However, I only have the icon in the face and no space to type the search information. How can this problem be solved?
    Is it because of my Add-ons?

    Try:

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the Add-ons is the cause of the problem (switch to the DEFAULT theme: Tools > Modules > themes).

    • Makes no changes on the start safe mode window.

    See:

  • Using ListView with ArrayDataModel displays only the first element in each QVariantMap within the matrix

    I have this QML who have a ListView with datasource to a full ArrayDataModel from the CPP file for creationcompleted, I loop in the table to add the hour together to appear as a label on the page, what works. However, when I want to view these items in the list, it will display only the first element of the QVariantMap within the table, no error on the log of the device. Also, triggered more does not work, but when I click it, it will have a blue border surrounding it, but the onTriggered does not fire.

    Here is an excerpt of the CPP on the table fill

    This-> eventsModel = new ArrayDataModel();

    QVariantMap event;

    event ['EventName'] = "Event1";

    event ["EventHour"] = "00";

    event ["EventMinute"] = "01";

    event ["EventSecond"] = '02 ";

    QML-> setContextProperty ("eventsModel", it-> eventsModel);

    Here's the QML

    {Of container

    ID: eventListContainer

    {To ListView

    ID: eventList

    dataModel: eventsModel

    Use a ListItemComponent to customize the appearance of the list view

    listItemComponents:]

    {ListItemComponent}

    type: 'point '.

    {StandardListItem}

    Title: 'Event' + ListItemData.EventName;

    Description: "time:" + ListItemData.EventHour + ":" + ListItemData.EventMinute + ":" + ListItemData.EventSecond; "»

    }

    }

    ]

    onTriggered: {}

    var selectedEvent = dataModel.data (row);

    var eventDetailPage = eventDetailDefinition.createObject ();

    eventDetailPage.txtEventName.text = selectedEvent ['EventName'];

    eventDetailPage.pickEventTime.value = picker.dateFromTime(selectedEvent["EventHour"]+":"+selectedEvent["EventMinute"]+":"+selectedEvent["EventSecond"]);

    eventDetailPage.open ();

    }

    }

    Any help would be appreciated.

    Thank you.

    ListView determines ItemType of the element by calling the function itemType of the dataModel. By default, an ArrayDataModel returns an empty string for this call (see https://developer.blackberry.com/cascades/reference/bb__cascades__arraydatamodel.html).

    This leaves you with a few options:

    (1) If you have no header and all the elements are the same, you can make

    ListItemComponent {
         type: ""
         ...
    

    (2) If you have headers or different elements, you can extend ArrayDataModel and implement your own function of itemType

    (3) you can define a function of ItemType on your ListView in QML. Documentation:

    ListView called DataModel::itemType() for each item in order to know the type. QML, this can be overridden by declaring the itemType function (data, row) on the ListView element. ListView then call this function instead of the function DataModel.

    Here's how to create a list in QML which creates a header for all items on the high level and aStandardListItem for each item below the top level:

  • How to display only the total value in the upper part of the chart stacked

    Hi all

    I need to display only the total value at the top of the stacked chart in the report of obiee 11g. Can someone help me on this please.

    Thank you

    Hello

    Will be a little different approach suit you like the below a? Total for a day is displayed next to the attribute of the day. Here, the "daily amount" is also an attribute instead of a measure.

  • When one of my users start CC and select applications, nothing is displayed, only the arrow circling. What is c?

    When one of my users start CC and select applications, nothing is displayed, only the arrow circling. What is c?

    It is resolved, they did not have local Admin rights.

  • The program panel displays only the zoom-in video

    Hello!

    I just downloaded Adobe Premiere Pro CC 2014 and I can't view the video in the Panel of the program. The source of left panel shows full display while clip that the program on the right panel displays only the zoomed video (see below). Is it possible to change this? I am trying to edit the video in accordance with a separate audio file and need to see the entire video as I edit.

    Thank you!

    adobe premiere example shot.PNG

    It seems that it is doing things and your fair sequence is not sized according to the vertically oriented video. The source monitor panel displays the whole image because it didn't fit in a sequence that does not match the press.

    You must determine which parameters you want for your sequence (e.g. 1080 p 30 fps), add media (within the parameters of sequence, you gave) and adapts the video to fit black leaving on each side. Alternately, you could just drag the video file on the "new element" in the bottom right of the project Panel to a new sequence with the settings automatically according to the media, but then you will end up either cropping when exporting, or with a record high rectangular movie that not match most of playback environments. It is a common problem with all the video side that people these days with their phones and others. The video is inherently horizontal unless you look at it on a handheld device that has no particular 'up' direction.

  • Creative Cloud Desktop displays only the empty box

    CC Desktop displays only the empty box. Pass the mouse over it does NOT any screen. I tried to remove and reinstall the app without success. Running Windows 7 64 bit, version of the NVIDIA GeForce GTX470 335.23 driver. Any ideas?

    Clouds WHITE http://forums.adobe.com/message/5484303 screen

    - and step by step http://forums.adobe.com/thread/1440508?tstart=0

    - and http://helpx.adobe.com/creative-cloud/kb/blank-white-screen-ccp.html

  • display only the photos decreased

    Hello

    How to display only the photos decreased (do not know the translation German, used in the English version of Lightroom)?

    Is this really fair as possible show the pictures decreased AND unmarked?

    Carlos

    In the grid view, choose attribute at the top. There are 3 flags. From left to right: marked, Unflagged and rejected (probably your "refused"). They can be combined. For your example, you click on the flags of the 2nd and third.

    HAL

  • We display only the columns required dynamically?

    Hi all

    I have a scenario where I have 30 columns in the rtf model. All columns will never be displayed, only a privileged few will be available for display. The output file is so see the empty columns. Now, I want to display only the columns that contain data.

    FYI - can't know what columns are made up of data until we run the report.

    Any advice.


    Thanks in advance.

    Malenfant.

    Hello

    You can use the following text:

    Column heading:
    My label

    The data in the column:
    My data

    The @column will tell XMLP wheater or not that column should be indicated.

    I hope this helps you.

    Kenneth BR

  • Need help to write a MySQL query that returns only the peer matching records

    Because I don't know how to explain it easily, I use the table below as an example.

    I want to create a MySQL query that returns only the records that match counterparts where 'col1' = 'ABC '.

    Notice the ' ABC / GHI' record does not have a Counter-match ' GHI / ABC' record. This record must not be returned because there is no Counter-Party correspondent. With this table, the ' ABC / GHI' record should be the one returned in the query.

    How can I create a query that will do it?


    ID | col1 | col2
    --------------------
    1. ABC | DEF
    2. DEF | ABC
    3. ABC | IGS
    4. DEF | IGS
    5. IGS | DEF


    * Please let me know if you have no idea of what I'm trying to explain.

    I wanted to just the results where col1 = ABC, but I already got the answer I needed on another forum. Thank you anyway.

    SELECT a.col1,
    a.col2
    FROM table_name AS a
    LEFT OUTER
    Table_name JOIN b
    ON b.col1 = a.col2
    AND a.col1 = b.col2
    WHERE b.col1 IS NOT NULL AND a.col1 = 'ABC '.

  • Restricting the views to DISPLAY ONLY the rows CreatedBy current connected user

    I want to user Oracle views - restrict the view to DISPLAY ONLY the rows CreatedBy / current OwnedBy signed / authenticated user!

    What are the different approaches, I have something with;
    setNamedWhereClauseParam, but this must be called on each ManagedBean in the constructor, as I have now!
    This approach caused the button Edit/Save which simply calls the commit to stop working. In a complete view of all the lines, there is no problem, with
    the button requesting validation the selectedRow in af: table.

    Other means?

    Thank you

    It does not appear that your view object extends the framework with custom code extension class in dealing with populating the bind variable by default.

Maybe you are looking for

  • The pre beta englishGB Aurora version contain a virus Win32:Cutwail-, try e-mail support...

    Firefox - 22.0 has 2 .in - GB.win32.installer.exe extracted in c:\Documents and Settings\...temp...\setup.exe which is reported as virus by avast free antivirus

  • Not found boot device

    My laptop won't start. It is said the test of hard drive failure and the found boot device (3f0). I ran tests start, tests and test the hard disk without success. The computer is no longer under warranty. It is a HP mini.

  • Questions about the record HDD Recovery - Satellite L350D

    Hello everyone! I have a Satellite L350D with Windows Vista.I'm in my mind to reinstall.All my data from the two partitions are saved with the exception of a folder on my drive E Data "HDDRecovery" who shouldn't be modyfied or deleted, or whatever. I

  • Satellite A500 - HDMI never knit - error don't pass the test regza

    Hi mate, I come from Italy and, first of all, I want to apologize for my English... ^ ^I'll try to explain my problem: Whenever I try to connect to my Pc to my TV by HDMI port "Satellite A500'... an error pops up: _The tv is turned off or in standby

  • What this means: "Pleasg go to C: &#62;.

    I'm trying to fix my magic Jack and the first statement is: please go to C: > Documents and Settings > Application Data > Roaming > mjusbsp > IN00000 Then he said: copy the file named setup and close this file. It's not supposed me... How can I go to