get the last ten weeks date value

Hi friends,
I have a requirement in which I need to get a list of 10 dates starting today on the same week. something similar to below but a list of all the 10 dates on the same day of the week

Select sysdate-7 double

output:
2011-08-08
2011-08-01
2011-07-25
2011-07-18
2011 08-11
2011-07-04

and so on...

Note: All of the above dates fall on Monday. I think I can do it using connect by clause, but need the exact syntax. I tried my best to get the result

Please let me know.

Ok.

select sysdate -7*(level - 1) as dt from dual connect by level <= 11

Not tested, not connected to oracle.

Tags: Database

Similar Questions

  • get the last 6 months data

    can I have a query that needs to retrieve only the most recent 6 months of sysdate.

    output must
    month
    10/05/2011
    10/04/2011
    10/03/2011

    etc.

    Try this please

    SELECT TO_CHAR(ADD_MONTHS(SYSDATE,1-LEVEL),'MM/DD/YYYY')
    FROM DUAL
      CONNECT BY LEVEL <=6;
    
  • When I log on windows, I get a POP up window that reads C:/windows/sysWOW64/cmd.exe and I never had this before... UST's happened the last 2 weeks... Is this a problem?

    When I log on windows, I get a POP up window that reads C:/windows/sysWOW64/cmd.exe and I never had this before... UST's happened the last 2 weeks...  Is this a problem?

    Hi KostyKrew,

    I understand how it could be frustrating when things do not work as expected. Please, I beg you, don't worry I'll try my best to resolve the issue.

    Follow these methods and check if that helps:

    Method 1:

    Step 1:

    Check if you have the similar problem in safe mode, otherwise you can try to put your computer to a State of clean boot in normal mode and check if it works:

    Start your computer in safe mode

    http://Windows.Microsoft.com/en-us/Windows7/start-your-computer-in-safe-mode

    Step 2:

    Follow the article to perform the clean boot on the computer:

    How to troubleshoot a problem by performing a clean boot in Windows Vista and Windows 7

    http://support.Microsoft.com/kb/929135

    Warning: After using the boot is a way to solve your problem step 3 follow-up to reset the computer to start as usual.

    Method 2:

    I suggest you to download and run the latest Microsoft security on the computer Scanner and check if it helps:

    http://www.Microsoft.com/security/scanner/en-us/default.aspx

    Note: The data files that are infected must be cleaned only by removing the file completely, which means that there is a risk of data loss.

    Please follow all the steps and if the problem persists, return back and we will be happy to help you.

  • Get the last disc based on the date

    Version of database

    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64 bit Production
    PL/SQL Release 9.2.0.8.0 - Production
    CORE Production 9.2.0.8.0
    AMT for HP - UX: 9.2.0.8.0 - Production Version
    NLSRTL Version 9.2.0.8.0 - Production

    data and model table


    CREATE TABLE EXAMPLE
    (
    UNIT_ID1 VARCHAR2 (15 BYTE) NOT NULL,
    COLL_DATE1 DAY,
    ATTRIB_CODE1 VARCHAR2 (4 BYTE) NOT NULL,
    UNIT_ID2 VARCHAR2 (15 BYTE),
    COLL_DATE2 DAY,
    ATTRIB_CODE2 VARCHAR2 (4 BYTE),
    DATE OF AUDIT_INSERT_DATS NOT NULL
    )





    Insert into SAMPLE
    (UNIT_ID1, COLL_DATE1, ATTRIB_CODE1, UNIT_ID2, COLL_DATE2,
    ATTRIB_CODE2, AUDIT_INSERT_DATS)
    Values
    ('W039712008646', TO_DATE (OCTOBER 8, 2012 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'DP', 'W039712008646', TO_DATE (OCTOBER 8, 2012 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'),)
    'PP', TO_DATE (OCTOBER 9, 2012 11:10:56 "," MM/DD/YYYY HH24:MI:SS'));)
    Insert into SAMPLE
    (UNIT_ID1, COLL_DATE1, ATTRIB_CODE1, UNIT_ID2, COLL_DATE2,
    ATTRIB_CODE2, AUDIT_INSERT_DATS)
    Values
    ('W039712008646', TO_DATE (OCTOBER 8, 2012 00:00:00 "," MM/DD/YYYY HH24:MI:SS'), 'DP', NULL, NULL,)
    'DP', TO_DATE (OCTOBER 9, 2012 11:11:02 "," MM/DD/YYYY HH24:MI:SS'));)
    Insert into SAMPLE
    (UNIT_ID1, COLL_DATE1, ATTRIB_CODE1, UNIT_ID2, COLL_DATE2,
    ATTRIB_CODE2, AUDIT_INSERT_DATS)
    Values
    ('W039712008647', TO_DATE (OCTOBER 8, 2012 00:00:00 "," MM/DD/YYYY HH24:MI:SS'), 'DP', NULL, NULL,)
    'DP', TO_DATE (OCTOBER 9, 2012 11:15:18 ',' DD/MM/YYYY HH24:MI:SS'));)
    Insert into SAMPLE
    (UNIT_ID1, COLL_DATE1, ATTRIB_CODE1, UNIT_ID2, COLL_DATE2,
    ATTRIB_CODE2, AUDIT_INSERT_DATS)
    Values
    ('W039712008649', TO_DATE (OCTOBER 8, 2012 00:00:00 "," MM/DD/YYYY HH24:MI:SS'), 'TP', NULL, NULL,)
    'TP', TO_DATE (OCTOBER 9, 2012 11:15:39 ',' DD/MM/YYYY HH24:MI:SS'));)
    Insert into SAMPLE
    (UNIT_ID1, COLL_DATE1, ATTRIB_CODE1, UNIT_ID2, COLL_DATE2,
    ATTRIB_CODE2, AUDIT_INSERT_DATS)
    Values
    ('W039712008650', TO_DATE (OCTOBER 8, 2012 00:00:00 "," MM/DD/YYYY HH24:MI:SS'), 'RD', NULL, NULL,)
    'RD', TO_DATE (OCTOBER 9, 2012 11:16:10 ',' DD/MM/YYYY HH24:MI:SS'));)
    Insert into SAMPLE
    (UNIT_ID1, COLL_DATE1, ATTRIB_CODE1, UNIT_ID2, COLL_DATE2,
    ATTRIB_CODE2, AUDIT_INSERT_DATS)
    Values
    ('W039712008653', TO_DATE (OCTOBER 8, 2012 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'CX', NULL, NULL,)
    'CX', TO_DATE (OCTOBER 9, 2012 11:17:23 ',' DD/MM/YYYY HH24:MI:SS'));)
    COMMIT;

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

    unit_id W039712008646 has two records. I need a query to get the last disk based on audit_insert_dats. Any help is appreciated.
    I tried to use max (audit_insert_dats) but not able to get a record

    user_anumoses wrote:
    unit_id W039712008646 has two records. I need a query to get the last disk based on audit_insert_dats.

    You can use the ROW_NUMBER() analytic function

    SQL> select *
      2  from
      3   (select a.*,
      4     row_number() over(partition by UNIT_ID1 order by AUDIT_INSERT_DATS desc) rn
      5    from sample a)
      6  where rn = 1;
    
    UNIT_ID1        COLL_DATE ATTR UNIT_ID2        COLL_DATE ATTR AUDIT_INS         RN
    --------------- --------- ---- --------------- --------- ---- --------- ----------
    W039712008646   08-OCT-12 DP                             DP   09-OCT-12          1
    W039712008647   08-OCT-12 DP                             DP   09-OCT-12          1
    W039712008649   08-OCT-12 TP                             TP   09-OCT-12          1
    W039712008650   08-OCT-12 RD                             RD   09-OCT-12          1
    W039712008653   08-OCT-12 CX                             CX   09-OCT-12          1
    
  • get the last day of the week

    Hi friends,

    I have the below query that returns me the data as below:

    Select 'Label', to_number (to_char (to_date(start_date,'yyyy-mm-dd'), 'IW')) - to_number (to_char (add_months (sysdate,-6), 'IW')) + 1 as a weekly sum, (col1) val yyy_view
    where to_date(start_dt,'yyyy-mm-dd') between trunc (add_months(sysdate,-6)) and trunc (sysdate)
    Group of to_char (to_date(start_date,'yyyy-mm-dd'), 'IW')
    order of to_char (to_date(start_date,'yyyy-mm-dd'), 'IW')

    Label weekly val
    1 20 data
    2 24 data
    3 20 data
    4 28 data
    5 20 data
    6 24 data

    and so on...

    Now the requirement is to get the last date of the week for each week as below

    Label weekly val
    given 2011-08-30 20
    given 2011-08-23 24
    given 2011-08-16 20
    given 28 2011-08-09
    given 2011-08-02 20

    the weekly column should have the date of the last week. In the example above Wednesday is supposed to be the last date of the week.

    Kind regards
    Pradeep

    Missed the part "Wednesday is considered date of last week. The week is Thursday to Wednesday. If so:

    select  'Label',
             trunc(min(start_dt)) as day2,
            sum(col1 ) val
      from  yyy_view
      where start_dt between trunc(add_months(sysdate,-6)) and trunc(sysdate)
      group by trunc(start_date - 3,'IW')
      order by trunc(start_date - 3,'IW')
    /
    

    SY.

  • How to get the last day of the week?

    HII

    I can get the week number of calendar for a given date using

    SELECT to_char (to_date('04/04/2011','MM/DD/YYYY'), 'WW') FROM dual

    can any body tell me, how to get the last day of the week?

    and the answer should be: 04/08/2011(8th april)
    Thank you
    San

    Published by: sandeep9 on April 4, 2011 03:50

    Perhaps this...

    SQL> select trunc(sysdate,'WW')+6 from dual;
    
    TRUNC(SYSDATE,'WW')+
    --------------------
    08-APR-2011 00:00:00
    
    SQL>
    
  • How to get the last date of 3 days for the current month?

    Hello. Guy

    How to get the last date of 3 days for the current month?

    MY OUTPUT WOULD LOOK LIKE THIS

    JANUARY 29, 2016

    JANUARY 30, 2016

    JANUARY 31, 2016


    GUYS HELP ME / / /...

    SQL > select last_day (sysdate) - level + 1 double connect by level<= 3="" order="" by="">

    LAST_DAY)

    ---------

    29 JANUARY 16

    30 JANUARY 16

    31 JANUARY 16

  • How to get the last value

    Hi I have a senerion in which I want to get the last value: -.
    CREATE TABLE T1
    (NAME VARCHAR2(10), NO NUMBER, NO2 NUMBER);
    
    INSERT INTO T1 VALUES('A',10,20);
    INSERT INTO T1 VALUES('C',100,2);
    INSERT INTO T1 VALUES('B,124,5);
    INSERT INTO T1 VALUES('A',1,400);
    INSERT INTO T1 VALUES('B,2,234);
    INSERT INTO T1 VALUES('B',2,7);
    INSERT INTO T1 VALUES('C',21,12);
    INSERT INTO T1 VALUES('A',3,300);
    INSERT INTO T1 VALUES('B,55,1);
    INSERT INTO T1 VALUES('C',234,1);
    INSERT INTO T1 VALUES('B',20,72);
    INSERT INTO T1 VALUES('A',200,0);
    INSERT INTO T1 VALUES('B',546,32);
    INSERT INTO T1 VALUES('C',89,888);
    
    INSERT INTO T1 VALUES('B',485,12);
    INSERT INTO T1 VALUES('C',1,77);
    INSERT INTO T1 VALUES('B',339,12);
    INSERT INTO T1 VALUES('A',0,300);
    {\code}
    
    Now for all  A i want the value (order by name,no,no2) i.e value of no2 0
    for all b i want 32
    and for all c i want 1
    
    i.e last value in order by clause.
    
    i tried this 
    
     select name,no,no2,last_value(no2)
     over(PARTITION BY  name order by no,no2) nm
     from t1
    
    can anyone please help me?
    
    Thanks
    
    Edited by: vinod on Jan 6, 2012 8:58 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

  • Need to get the last value of the quarter

    Hi expert,

    I have data like this

    Amount DATE column column

    January $1 20

    |

    January 30, $50


    Fed 60 1
    |

    February 28, $80

    like that throughout the year


    I will provide the first promt and selects the 1st quarter. Then, it will show you Jan, Feb, March in the Date column and the respective amounts in the amount column.

    I need to put a formula into the amount column... So that I get the last day of the amonut of quarter.


    Any help is appreciated.

    Thank you
    V

    Published by: Vincent Krishna on May 25, 2011 06:43

    CASES WHERE 'Fiscal Date' = TIMESTAMPADD (SQL_TSI_DAY, TIMESTAMPADD (1), (SQL_TSI_QUARTER, 1, TIMESTAMPADD (SQL_TSI_DAY, DAY_OF_QUARTER (CURRENT_DATE) *-(1) CURRENT_DATE + 1))) THEN 'Fact - amount' END;

    Apply the filter above on your amount column.

    Thank you
    -Laurence.

  • How to get the day as a numeric value without the date in shape?

    Hello
    to reduce the costs of a sql statement, I need to get the day of a date under the number (to compare to a numerical value) value without formatting. Each formatting causes a complete table of the table scan and the date field. Is there a function for this problem?

    Version of Oracle's 11g.

    Thank you Carsten

    You can use EXTRACT...

    SQL> select extract(day from sysdate) from dual;
    
    EXTRACT(DAYFROMSYSDATE)
    -----------------------
                          7
    
    SQL>
    
  • How to get the last business day of the previous month?

    Hi all

    We need the user as below,

    If the user select 18 June 2015 ' quick dashboard as the input value, and then they want to see last month last day of work (business date: 29-may-2015) amount in report, if you have an idea please share with us.thanks

    Note:

    use under request we can able to get the last day of the previous month, we want to for the last business day of the last month, based on the date of entry of the user?

    TIMESTAMPADD (SQL_TSI_DAY,-(1), TIMESTAMPADD (SQL_TSI_DAY, DAYOFMONTH ("DIM_TIME". ("" DataDate ") *-(1) + 1,"DIM_TIME ". (("" DataDate "))

    Thank you

    Deva

    Try this,

    case when Dayofweek (timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15')) = 1 then timestampadd (sql_tsi_day, (Dayofmonth(Date '2015-06-15') *-1)-2, Date '' 2015-06-15) when Dayofweek (timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15')) = 7 then timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1-1, Date '' 2015-06-15) another timestampadd (sql_tsi_day, Dayofmonth(Date '2015-06-15') *-1, Date ' 2015-06-15') end

    As Ftsiot said in this post, it will work only to exclude the sat and Sun. Another one if you want to exclude regional holiday, you may need a calendar in DB table.

    Thank you

    AJ

  • How to get the last parameter of exprision regular

    Hi all!
    I need to extract the last date in the string.
    Here my code
     Pattern pattern = Pattern.compile("(19|20)\\d\\d([- \\\\/.](0[1-9]|1[012])[- \\\\/.](0[1-9]|[12][0-9]|3[01]))?");
    Matcher matcher = pattern.matcher(text);
    
    while(matcher.find()) {
    
             
    System.out.println(matcher.group());
    How can I get the last date

    Example->

    Hello all the date is 2010-12-12 the date is 2010-10-10
    and I want to get-> 2010-10-10

    Thank you!

    Just assign the value of the find to a variable declared outside the loop. The variable will hold the last game when you exit the loop.

    Kaj

  • How to get the max of an element value selected iota AF Max.

    Hello community,

    Let me explain the scenario.

    We have a workbook of discoverer, who have several reports. These reports extract information from multiple views built specifically to retrieve information in several tables. So far, quite normal.

    Like any other report you can build these views, you can select the elements (columns) that you will use to create the report. Some of these elements (columns) are selected with the function MAX aggregate for this element; is that to say, instead of the profit of the item, and then click the SUM aggregation function, select the MAX aggregate function. With this option, we can get limit the number of search results.

    In our case, we have created a report that shows the items that we have in our stock, for each item, the report shows the sum of kilograms, the average price, its value (the sum of the average price x kilograms) for each element of the family, and we want the report to display for each item (remember that each element is a line in the report or folder) the largest number of transaction_id (of which there been selected using MAX aggregate function for the selected item), but a kind of transaction types.

    Let's see an example:

    Family | Product name | Sum of the kgs. | Units | Average price | Value of stock. Month | Year | Transaction ID | Type of transaction | Date of movement
    4420 | ALUMINA PS - M BB720 | 97.680,000 | KG | 44737 | 43.699,10 | 04. 10. 7740531 | Finalización Conjunto WIP | 16/12/2009
    4420 | ALUMINA PS - M BB720 | 47.760,000 | KG | 44737 | 21.366,39 | 04. 10. 8100110 | EXCESS | 31/03/2010
    4420 | ALUMINA PS - M BB720 | 97.680,000 | KG | 44737 | 43.699,10 | 04. 10. 8201603 | EXCESS | 30/04/2010

    Considerations:

    The value you see in the Transaction id is the maximum value that the field have; is that to say, each of the types of transactions, it shows the highest (last) transaction that id. looking at the example, the problem now is that we want to pocket the result a llitle little more. We want the report to show only from each product name or transaction id higher, either the date of circulation higher (as in the example above matches the transaction id 8201603 that have the highest movement 30/04/2010 - date).

    I stopped at that point because I don't see how to filter the data to get the result we want.

    Any suggestion or help would be appreciated, cause honestly, I don't see how.

    Thanks in advance.

    Luis.

    Hi Luis
    In order to get the last day of the month, given a year and month as strings, you will need to convert the strings to a date. Assuming you have a two-digit month and, presumably, a 2 digit, with the year 2000 year and more, then you need to start with a date and let's start with the first day of the month like this:

    To_date ('01' |: month: year, 'DDMMYY')

    You can use the ADD_MONTHS function to spend the month by one and then if you subtract 1 from that you will end up with the last day of the month.

    EndofMonth = ADD_MONTHS (TO_DATE ('01' |: month |: year, 'DDMMYY'), 1)-1

    You can also use the LAST_DAY function like this:

    EndofMonth = LAST_DAY (TO_DATE ('01' |: month |: year, 'DDMMYY'))

    Best wishes
    Michael

  • Draw the last set of data (1000 samples) in a loop

    Hi, I read a waveform data continuously, but I would capture and draw the last data set after my stop. As shown in the picture of attacehd, when the condition is true I acquire data. The number of samples per read is 1000, and as you can see I used a shift register to store data. What I'd like to see where the loop stops is the last 1000 samples but when I acquire real-time data I get a random sample number when the loop stops. sometimes 90 samples, sometimes 950 samples etc... could you please let me know how can I get the last 1000 samples acquired in this loop

    I even used DAQmx buffer for data but I can not get the last 1000 samples

    Thank you

    If your task has a number of points to buy, I don't see how you could have a number UN predictable and random points in the buffer.  The task should stop after having acquired the points of "N" and then say it's done.

    What do you mean by "stop tripping?  You only have a 'start' trigger and it is not available for points once the task has been involved.  If you want the last 1000 points of the points "samples per channel", the last reading should return those.  I've never used the property "Done" before.  Count your samples read instead and stop once you have what you wanted.

  • How to get the last day of a month for every 2 months for a given period?

    Hello

    Can is it some please let me know how to get the last day, last day of the week, the weekend last day, last Monday, one month for every 2 months for a given period?

    Thanks in advance.

    Try the below

    SELECT LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))) lastday.

    BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'SAT '.

    SO LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))-1

    WHERE TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'Sun '.

    THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))-2

    Of OTHER LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    END as lastweekday,

    BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') IN ('Sam', 'SUN')

    THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    Of OTHER LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    -(TO_NUMBER (TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))),' from)) - 1).

    END as lastweekendday,

    BOX WHEN TO_CHAR (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), 'DY') = 'MY

    THEN LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2)))

    Of OTHER NEXT_DAY (LAST_DAY (ADD_MONTHS (TRUNC(startdate,'MM'), ((LEVEL*2)-2))), "LUN")-7

    END AS lastmonday

    FROM (SELECT SYSDATE startdate,

    SYSDATE + 300 enddate

    THE DOUBLE)

    CONNECT BY LEVEL<=>

Maybe you are looking for

  • Remote Desktop and Cisco Small Business RV042

    With our old router Linksys Wireless on the issue of applications we can redirect the port, for example: Remote desktop access from external pc: 201.85.X.X:1234 (to appoint our public IP and port 1234) Whit this we can access the private 10.1.X.X in

  • ISE Airespace WLC ACL problem

    Hello I have configured ISE and WLC for use with CWA guestportal but there is a problem with the CoA - he won't apply airespace alc after auth to guestportal. 1. on page authC, I configured a MAB wireless to continue if not found user and use an inte

  • problem of gadget gallery that gadgets are displayed for one second & yet they gets disappeared

    I can't open my Gallery of gadgets when I try to open my Gallery, gadgets are displayed for one second, & yet they gets disappeared. Please help me in Re install my Gallery or if there may be another procedure to pass through.

  • Touch slider crashes on me.

    Hi allWe bought an Acer laptop may this year and the touch cursor hangs on me soon after having turned it on and I end up having to turn it off. I am not computer savvy and I only know basics but any suggestions or help would be very appreciated.

  • To avoid cancellation fees?

    Is there anyway to avoid paying cancellation fees? I don't have that kind of money. I have switched to DollarStock because they went bankrupt. I can't afford to pay the 165.95. Is there an email where I can contact Adobe?