How to get data that are created the or before the last Wednesday

Hi, can someone please tell me how to write a query to retrieve the data that are created the or before last Wednesday.

Thanks in advance...

Hello

Here's one way:

WHERE created_date< next_day="" (="" trunc="" (sysdate="" )="" -="">

, "THURSDAY".

)

"Before Thursday' means the same as 'the or before Wednesday '.

This assumes that NLS_DATE_LANGUAGE is English.  If you are not sure what is NLS_DATE_LANGUAGE, you can do this:

WHERE created_date< next_day="" (="" trunc="" (sysdate="" )="" -="">

, TO_CHAR (DATE ' 2014-03-06' - or any Thursday)

, 'DAY '.

)

)

There is nothing magical about March 6, 2014; will do any Thursday.  To_char will return the translation of 'Thursday' in all that is the current NLS_DATE_LANGIUAGE, and NEXT_DAY can use this value.

Tags: Database

Similar Questions

  • Table of DB tools list: how to access tables that are in the different SQL database?

    Hi all

    I work on an implementation of database (SQL server) and evaluates the Toolkit OR DB for this project.

    One of the requirements is that I need access to the tables that are in two different database

    (say Table to 1 DB and Table B to 2 DB).

    Our IT guy linked table in DB1 to DB 2 and I verfied this when I use the SQL server management studio.

    When DB 2 tables is filled, table from DB1 is also there. I can also do the same thing using MS Access.

    Table A of the DB1 is available for me enven if I only connect to 2 DB.

    Here comes the problem.

    When I use DB tool list Table.vi to access DB2, it does NOT list A table in DB1. It list only the tables in

    the database (DB2) which I am connection (using DB tool opened Connection.vi with a file DSN)

    So my work around right now is to open a separate connection both DB1 and DB2. However, this approach

    obviously creates a problem when I have to access a separate database constantly in my application.

    What would be a solution to this? I have search the Forum but only to see a post that is somewhat related to

    My question. (And it was published the 2004) Maybe I need to change the code in the orignial VI (DB tool list Table.vi)?

    My computer guy told me that he has not met this scenario since he wrote code in another environment such as

    VB and others and it has always been successful in linking the different database tables.

    I hope my question is clear and healthy because I don't really know much about database terminology.

    Any comment or suggestion is appreciated!

    Thank you

    Chad

    Ok.  Here is some information that I can work with.  Good.

    Your COMPUTER staff created a view called "VISUAL_WORK_ORDER".

    A view isn't a table.  It is a "virtual" table  Views are used to collect data (usually) in several different tables.

    But I guess that the code inside the DB tool list Table.vi returns a list of tables.  Views are not the tables.  Then "VISUAL_WORK_ORDER" does not appear in the list.

    HOWEVER, this should not really matter.  The view is here!  And it can be queried like any table.  So, you can use DB tools Select Data.VI... and wire in "VISUAL_WORK_ORDER" as the name of the table.  This will return the contents of the view.  Alto!

  • How to get an average displacement of the last 5 lines that were NOT NULL?

    I have a question involving a moving average, and it works fine using:

    AVG (col_x) more (partition col_a, col_b, col_c lines between 5 preceding and 1 preceding arrested)

    However, I want to change this option to give the average of the last 5 lines which were non-null.  Does anyone know how to do?

    For example:

    create table sample_table)

    col_a varchar2 (10),

    date of col_b,

    col_c number (2),

    col_x number (5.2)

    );

    insert into sample_table values ('X', trunc (sysdate), 1, 1);

    insert into sample_table values ('X', trunc (sysdate), 2, 2);

    insert into sample_table values ('X', trunc (sysdate), 3, 3);

    insert into sample_table values ('X', trunc (sysdate), 4, 4);

    insert into sample_table values ('X', trunc (sysdate), 5, 5);

    insert into sample_table values ('X', trunc (sysdate), 6, 6);

    insert into sample_table values ('X', trunc (sysdate), 7, 7);

    insert into sample_table values ('X', trunc (sysdate), 8, null);

    insert into sample_table values ('X', trunc (sysdate), 9, null);

    insert into sample_table values ('X', trunc (sysdate), 10, null);

    insert into sample_table values ('X', trunc (sysdate), 11, null);

    insert into sample_table values ('X', trunc (sysdate), 12, null);

    insert into sample_table values ('X', trunc (sysdate), 13, null);

    insert into sample_table values ('X', trunc (sysdate), 14, null);

    insert into sample_table values ('X', trunc (sysdate), 15, null);

    Select t.*,

    AVG (col_x) on myavg (partition col_a, col_b, col_c lines between 5 preceding and 1 preceding arrested)

    of sample_table t

    order by 1,2,3;

    COL_A, COL_B, COL_C MYAVG COL_X

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

    X 15/01/2015 1 1.00

    X 15/01/2015 2 2.00 1

    X 15/01/2015 3 3.00 1.5

    X 15/01/2015 4 4,00 2

    X 15/01/2015 5 5.00 2.5

    X 15/01/2015 6 6.00 3

    X 15/01/2015 7 7.00 4

    X 15/01/2015 8 5

    X 15/01/2015 9 5.5

    15/01/2015 X 10 6

    X 15/01/2015 11 6.5

    X 15/01/2015 12 7

    15/01/2015 X 13

    15/01/2015 X 14

    X 15/01/2015 15

    15 selected lines

    What I really want is:

    COL_A, COL_B, COL_C MYAVG COL_X

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

    X 15/01/2015 1 1.00

    X 15/01/2015 2 2.00 1

    X 15/01/2015 3 3.00 1.5

    X 15/01/2015 4 4,00 2

    X 15/01/2015 5 5.00 2.5

    X 15/01/2015 6 6.00 3

    X 15/01/2015 7 7.00 4

    X 15/01/2015 8 4

    X 15/01/2015 9 4

    X 15/01/2015 10 4

    X 15/01/2015 11 4

    X 15/01/2015 12 4

    X 15/01/2015 13 4

    X 15/01/2015 14 4

    X 15/01/2015 15 4

    15 selected lines


    concerning

    Neil

    Hello

    Here's one way:

    WITH got_avg AS

    (

    SELECT T.*

    AVG (col_x) OVER (PARTITION BY col_a, NVL2 (col_x, 1, 0)

    ORDER BY col_b, col_c

    LINES BETWEEN 5 PRECEDING

    AND 1 PRECEDING

    ) AS myavg

    OF sample_table t

    )

    SELECT col_a, col_b, col_c, col_x

    LAST_VALUE (myavg IGNORE NULLS) over (PARTITION BY col_a

    ORDER BY col_b, col_c

    ) AS myavg

    OF got_avg

    ORDER BY col_a, col_b, col_c

    ;

    Too bad, that we cannot use the IGNORE NULLS with AVG function.

  • Smartphones blackBerry [9700 "Bold"] how to get emails that are not gmail, yahoo,...?

    Hi guys,.

    I saw a small company and goes to buy a Blackberry Bold 9700. I read a lot of forums and boards, but I have still not found an answer to the question: "is it possible to get e-mails from accounts that are not google or yahoo etc."?

    I have a clean online store or the domain and so my email address is something like info @.com

    I am currently using Thunderbird on my laptop to get and send e-mails via pop3/smtp.

    So, it is possible to have access to e-mail via a pop3 server and send emails using smtp on a Blackberry 9700 Bold?

    Greetings,

    Marco.

    Yes, you can access most of the protocols POP3 or IMAP mail server.

  • How to display data that filled by the user after you send the form?

    Right now I am doing a project on the e-complaint, can someone help me how to view the data that have been filled by the user based on the submitted form which also displays the primary key for the reference of the user.

    Here is my form code:

    <?php
      if(isset($_POST["compSubmit"])){
    
      $category=$_POST['category'];
      $typeDamage=$_POST['typeDamage'];
      $serial=$_POST['serial'];
      $location=$_POST['location'];
      $description=$_POST['description'];
      $name= $_SESSION['sess_nama'];
      $SiD=$_SESSION['sess_sID'];
      $Course= $_SESSION['sess_Course'];
    
    
      $con=mysql_connect('localhost','root','') or die(mysql_error());
      mysql_select_db('kktm') or die("Cannot select DataBase");
    
    
    $sql="INSERT INTO complaint2(Name,ID,Department_Course,Category,Type_Damage,Serial,Location,Data_Time,Complaint,Status,Report) 
    VALUES ('$name','$SiD','$Course','$category','$typeDamage','$serial','$location',NOW(),'$description','Pending','')";
      $result=mysql_query($sql);
      }else {
      echo "Fail to Complaint!";
      }
      ?>
    

    I hope someone can help me with this...

    Thank you.

    You use the deprecated mysql connection. YOU NEED to SWITCH TO MYSQLI OR PDO.

    You also do not have a data validation and remediation. You really need to.

    But to answer your question, you can add the following code:

    ECHO '.

    ";

    print_r($_POST);

    echo "

    ";

  • How to get data hardbounce retrospective of the most recent date?

    I want out of backdata Hard bounce by last date using the API.

    Can someone help me?

    Any suggestion is appreciated.

    Kind regards

    Shashi Kant

    BLOCK has an API "/ activities" endpoint, you can use to define an excerpt. You can programmatically add a filter him every time you kick off your snippet (something like ActivityDate > = and set the current date as the side right of the > = parameter). You can then use the ' /extracts/data "endpoint to extract the data returned by eloqua sync. See the documentation for the API BLOCK to get an idea of a typical eloqua extraction process.

  • How to remove objects that are created with the new

    Hello

    I'm having a problem create a behavior or a script to remove the new sprites created in the channels. I have a behavior script that creates new sprites using the following (Simplified) script:

    First of all, a Beginsprite creates a gChannel_list and assigns a value of gChannel from the beginning. pSprite is used to set the sprite that is clickon in the mousedown .

    on Beginsprite me
    gChannel_List =]
    gChannel = 70
    pSprite = sprite (Spritenum)
    end


    In the mousedown gChannel is incremented and the newly created channel is added to the gChannel_list.

    on Mousedown me

    gChannel = gChannel + 1
    theChannel = addat (gChannel_List, gChannel)
    Members = pSprite.member

    ........

    (gChannel) channel .makeScriptedSprite (Member, point (80,160))
    Sprite (gChannel) .width = thememberW
    Sprite (gChannel) .height = thememberH
    Sprite (gChannel) .rotation = theMemberR
    Sprite (gChannel) .moveablesprite = 1
    Sprite (gChannel) .encre = 36
    ........

    etc.

    After the creation of several sprites based on the gChannel, globals include, for example, are returned.

    -Global Variables-
    gChannel_List = [71,72,73,74]
    gChannel = 74


    My problem is that I cannot delete these created gchannel sprites with a command of jargon. Remove them from the list, for example, using deletat(gChannel,1), does nothing to remove them from the scene (they disappear from the list). And while I can view their attributes such as width [n = getat (gChannel_list, x); put .width sprite (n)], nothing seems to relate to the removal of these gchannel sprites.

    How do we?

    Hope this is enough information. If this isn't the case, please let me know. I can give you everything that you could possibly need. Help, please.

    Stem




    You used "makeScriptedSprite()" to add a sprite channel. Try to use the reverse: "removeScriptedSprite()."

  • Number of weeks between two dates that are in the same or different year

    Hello

    How to calculate the number of weeks between two dates?

    for example. "" "17-mar-2013' and June 27, 2013" or June 15, 2013 "and" 25-mar-2014


    Thanks in advance.

    lukx

    Hello

    Looks like your date range is incorrect.

    Please try the below.

    SQL >-front right

    SQL > select D2 - D1 "days."

    2 round ((D2-D1)/7.0) "weeks."

    3 round (Months_between (d1, d2), 0) 'months '.

    (select 4

    5 TO_DATE ('20121201', 'YYYYMMDD') D1, D2 TO_DATE ('20130116', 'YYYYMMDD')

    6 from two

    (7) date_range;

    Elapsed days weeks months

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

    46         7         1

  • How to get data from a URL with as3

    Hello

    I need to get data that is in the view of the source of an external Web page, how it can be done?

    URLLoader allow to get the HTML code as text, then you need extract it.

  • How to get data from a URL with as2

    Hello

    I need to get data that is in the view of the source of an external Web page, how it can be done?

    Use loadvars and our method.

  • How to make the color of ScrollBar that are created using the css code is displayed in Windows 8

    I wish I could understand how to get the color of ScrollBar that are created using the css code appears on my web design theme games. But I can't see them in Windows 8. Is there something that I need to enable to see colorful scroll bars? I'm used to be able to see them on my Windows XP computer. It is important for me because a lot of people like models with colorful scroll bars.

    Open the Tools menu and turn on "Compatibility view" to do.  Note that this works only in the desktop version of Microsoft Internet Explorer.

  • Not possible to export a list of virtual machines that are created in the past 7, 30, 120 and 180 days since an imported csv file containing the date of creation of virtual machine

    Not possible to export a list of virtual machines that are created in the past 7, 30, 120 and 180 days since an imported csv file containing the date of creation of virtual machine. My questions is the correct statement to the variable: $VmCreated7DaysAgo: $_CreatedOn "-lt" $CDate7.

    # #SCRIPT_START

    $file = "C:\Users\Admin\Documents\WindowsPowerShell\08-18-2014\VM-Repo.csv".

    $Import = import-csv $file

    $VMCreatedLast7RDayRepoFile = "C:\Users\Admin\Documents\WindowsPowerShell\08-18-2014\Last7Days.csv".

    $start7 = (get-Date). AddMonths(-1)

    $CDate7 = $start7. ToString('MM/dd/yyyy')

    $VmCreated7DaysAgo = $Import | Select-object - property name, Powerstate, vCenter, VMHost, Cluster, file, Application, CreatedBy, CreatedOn, NumCpu, MemoryGB | Where-Object {$_.} CreatedOn - lt $CDate7} | Sort-Object CreatedOn

    $TotalVmCreated7DaysAgo = $VmCreated7DaysAgo.count

    $VmCreated7DaysAgo | Export-Csv-path $VMCreatedLast7RDayRepoFile - NoTypeInformation - UseCulture

    Write-Host "$TotalVmCreated7DaysAgo VMs created in 7 days" - BackgroundColor Magenta

    Invoke-Item $VMCreatedLast7RDayRepoFile

    # #SCRIPT_END

    You can use the New-Timespan cmdlet in the Where clause, it returns the time difference between 2 DateTime objects.

    An example of this cmdley

    New-TimeSpan-start (Get-Date). AddDays(-7)-end (Get-Date). Select days - ExpandProperty

    In your case, you could do

    Where {(New Timespan-démarrer ([DateTime] $_.))} CreatedOn) - end $start7). {7 days - gt}

    But beware of negative numbers.

  • How can I check for dates that are the same for today.

    If I have a bunch of dates in a datetime colum. How can I check for dates that are the same for today.
    "For example, this value of days would be ' #dateFormat (now (),"mm dd yyyy") #

    The best I could come up with was:

    Select * from data where data.userID =
    2635 AND
    "Convert (varchar, dateAdded, 101) = ' #dateFormat (now (),"mm dd yyyy") #


    How can I get this to work smart peeople :)

    It is best to make the comparison on the datetime values. One technique is to get the current date at midnight. Then add one day to get tomorrow's date. In your sql query finds all values is greater than or equal to today and less than tomorrow.

    One solution is to do everything in MS SQL

    WHERE the dateAdded > = convert (datetime, convert (varchar, getdate(), 112), 112)
    AND dateAdded = dateAdd (d, 1, convert (datetime, convert (varchar, getdate(), 112), 112))

    Another option could be to use CF to calculate dates:


    WHERE the dateAdded > =.
    AND dateAdded<>

  • How do I date stamp photo with the date that it was created?

    How do I date stamp photo with the date that it was created?

    donaldm80418165 wrote:

    How do I date stamp photo with the date that it was created?

    Use the text tool.

    Note that you can select the font, color, size of the pt.

  • How to delete all TABLEs in the schema SYS that are created from 09:15?

    Unfortunately a script created a lot of tables in the diagram (= SYS) and bad Tablespace (= SYSTEM).

    How can I delete all TABLES that are created inTablespace = SYSTEM and SCHEMA = SYS (in a DDL command)
    respectively for the past 3 hours from 09:15 to 25 Sep 2011?

    Alternative: How can I move these tables in another schema (for example ATEST) and Tablespace (USERS)?
    Is this possible with Oracle XE or Oracle Enterprise?

    Peter

    You can use ALTER TABLE... MOVE. It offers a TABLESPACE clause, which allows you to choose a different tablespace as target. Refer to the documentation for your version of the database.

Maybe you are looking for

  • How can I download a previous version of firefox? for mac

    I am a Gov't employee and only older versions of firefox are compatible with our website fedtraveler. They list we must use firefox 3.0, 3.5, 3.6, 4.o, 5.0, 6.0 or 7.0 (for Mac OS x Lion) only. The latest version 9.0 does not work or is blocked for s

  • How can I make Windows Media player the default player of my browser.

    I can't listen to the station for WYSL 1040 AM radio on the web. They say that the default player on my browser must be Windows Media Player. How to respect their demand?

  • Scan for edit in Word

    Product: HP Photosmart C4280 all-in-one printer model Product: HP Pavilion a6528p mode Operating system: 32-bit Vista MS I have a 4 Word print pages that I created 4 years ago on my old PC so I don't have it on my current PC. How do I use my scanner

  • T61p how can I back up my hard drive

    Hello My laptop out of no where would not turn on and exposes the 1 long beep and 2 short beeps with a white screen. He is 5 years old and started to act a little, so I had to replace anyway, but my question is how can I save my drive hard if I can't

  • Upgrade Ram 14 HP.

    I recently bought a laptop HP 14 with 4 GB of ram preinstalled and windows 8. I would like to make an upgrade of RAM but I have no idea what is the limit of the computer or of what type of memory, I have to buy. I'd appreciate the help. Thank you. Yo