How to exclude a date from a query

Hi all

I have a request to the user that are not sice connection 2 days of audit, but to exclude these days that are holidays in the calculations.

SELECT active_directory_user FROM SYSTEM_USERS WHERE active_directory_user IN
(SELECT DISTINCT active_directory_user from admin. SESSION_AUDIT WHERE LOGON_TIME < SYSDATE-1);
How to exclude Sundays for example?
My paintings is less than
SQL> DESC SYSTEM_USERS
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ACTIVE_DIRECTORY_USER                     NOT NULL VARCHAR2(30)
 PASSWORD                                           VARCHAR2(50)
 DEPT                                               VARCHAR2(20)
 ROOM                                               VARCHAR2(10)
 ROOM_PHONE                                         VARCHAR2(30)
 MOBILE#                                            VARCHAR2(20)
 TOTAL_LOGINS                                       NUMBER
 USER_STATUS                                        VARCHAR2(20)

SQL> DESC SESSION_AUDIT
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ACTIVE_DIRECTORY_USER                              VARCHAR2(30)
 LOGON_TIME                                NOT NULL DATE
 APPLICATION_USER                          NOT NULL VARCHAR2(30)
Published by: Maahjoor on February 5, 2013 22:50

Maahjoor wrote:
Hi all

I have a request to the user that are not sice connection 2 days of audit, but to exclude these days that are holidays in the calculations.

SELECT active_directory_user FROM SYSTEM_USERS WHERE active_directory_user IN
(SELECT DISTINCT active_directory_user from admin. SESSION_AUDIT WHERE LOGON_TIME<>
How to exclude Sundays for example?

select active_directory_user
from system_users
where active_directory_user in
  (
    select distinct active_directory_user
    from admin.session_audit
    where logon_time
                 

Tags: Database

Similar Questions

  • How to exclude certain folders from the result of the query

    I'm writing a query to exclude some records from a query. Normally, of course, I do it with a NOT IN or use SUBTRACT. However, I can not do with these records because it is not working properly. There is a table called SHRTRCE that contains fields for PIDM, SUBJ, COURSE and TITLE, coded as follows:
    create table SHRTRCE
    (
    PIDM     NUMBER     NOT NULL
    SUBJ     VARCHAR2(10)
    COURSE     VARCHAR2(6)
    TITLE     VARCHAR2(30)
    )
    /
    INSERT INTO SHRTRCE
    (PIDM,SUBJ,COURSE,TITLE)
    VALUES
    (12345,MATH,1X0501,COLLEGE ALGEBRA)
    /
    INSERT INTO SHRTRCE
    (PIDM,SUBJ,COURSE,TITLE)
    VALUES
    (12345,ENG,2X1001,COMPOSITION II)
    /
    INSERT INTO SHRTRCE
    (PIDM,SUBJ,COURSE,TITLE)
    VALUES
    (12345,PSYC,1X0101,GENERAL PSYCH)
    /
    INSERT INTO SHRTRCE
    (PIDM,SUBJ,COURSE,TITLE)
    VALUES
    (23456,ENG,1X1001,COMPOSITION I)
    /
    INSERT INTO SHRTRCE
    (PIDM,SUBJ,COURSE,TITLE)
    VALUES
    (23456,PHY,1X3201,NON-LAB PHYSICS)
    /
    INSERT INTO SHRTRCE
    (PIDM,SUBJ,COURSE,TITLE)
    VALUES
    (34567,MATH,1X0501,COLLEGE ALGEBRA)
    /
    INSERT INTO SHRTRCE
    (PIDM,SUBJ,COURSE,TITLE)
    VALUES
    (34567,MATH,2X2010,CALCULUS I)
    /
    I want to do is pull ONLY the records for these PIDMS where there is no class with the OBJECT of MATHEMATICS. So, in this case, I want only the values for PIDM 23456. If I use NOT IN, I always get PIDMs in my list where the person did one or more courses of MATHEMATICS; only, it excludes courses, which are MATHEMATICAL, but leaves others. If I use a SUBTRACTION, producing the same results. I don't know how to proceed at this point. I'm going to cut him, but thought I'd post something because I know it is probably something easy enough, I'm simply not anywhere in my books.

    Thank you very much
    Michelle Craig
    Data Coordinator
    Kent State University

    Published by: BluShadow on January 10, 2012 14:23
    fixed {noformat}
    {noformat} tags.  the word "code" must be lower case in both tags                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    Do not know what is the problem with NOT IN for you, seems ok to me...

    select *
    from shrtrce
    where pidm not in (select pidm from shrtrce where subj = 'MATH')
    
  • I transferred all my info to my new 6 s.  How to clear all data from old 4S?

    I transferred all my info to my new 6 s.  How to clear all data from old 4S?

    Follow the contours of the steps in this Apple Support page:

    What to do before you sell or give away your iPhone, iPad or iPod touch - Apple Support

  • How can I download data from key USB flash to a Windows 7 computer

    I need to transfer some files from my PC to my PC Windows 7 Windows XP using a USB flash key. I've used Windows Easy Transfer to move my files without problem and some programs but did not download some files. I downloaded these files on a USB flash and I can access the files, as long as the stick is pluged. How can I download data from the USB flash on my Windows 7 computer

    Hello

    The following video may help:

    http://www.YouTube.com/watch?v=hrMQh0Xkpvs

    or this article:

    http://www.swarthmore.edu/documents/administration/its/how%20To%20Use%20A%20USB%20Flash%20Drive.PDF

    and here:

    http://TECHTIPS.salon.com/use-USB-flash-drive-transfer-files-PC-Mac-2544.html

    (Mac here can be a PC).

    Good luck.

  • How do I export data from one day to backup disk.

    Hi all

    Here we have a requirement like, we need to download the data from one day to the external drive and we must compire the exported data and the data in the table.
    I googled and I have discovered that using expdp command we can export the table content, but my Question is how do I export data from one day. My table having 2 years of data and I need download the data of only one day.

    expdp scott/tiger@db10g tables = EMP, DEPT = TEST_DIR dumpfile = EMP_DEPT.dmp expdpEMP_DEPT.log = logfile directory

    Can someone tell me how to download data from one day to the table & compare data exported with the data in the table. (I know both exported and data of the table data will be the same that we are downloading data of the actual table, but for tests, I need to know how to compare).


    Thank you
    Sree

    However, I do not understand the scenario but here is a way to compare:
    (1) change the name of the table newly created in another name
    (2) import the exported file once again

    you will have the same data in both tables

  • How can I get data from each associated XMLnode in movieclips separated when you click a line in the combobox

    How can I get data from each associated XMLnode in movieclips separated when you click a line in the combobox?

    A sample of XML is like this:

    <>planter

    < Lauvtre >

    < Botanisk_navn > Acer campestre < / Botanisk_navn >

    < Norsk_navn > Naverlonn < / Norsk_navn >

    Gronn < Farge > < / fan >

    H4 < Herdighet > < / Herdighet >

    < Hoyde > 10-15 m < / Hoyde >

    < / Lauvtre >

    I have a combobox where it shows the botanical name and the Norwegian name. But the rest of the info in movieclips seem separate.

    Someone has an idea how to do this? Can I use the trace function maybe? Here is my AS3 code so far:

    var loader: URLLoader = new URLLoader();

    loader.addEventListener (Event.COMPLETE, onLoaded);

    list.addEventListener (Event.CHANGE, itemChange);

    function itemChange(e:Event):void

    {

    your. Text = list.selectedItem.data;

    TB. Text = list.selectedItem.label;

    }

    var xml;

    function onLoaded(e:Event):void

    {

    XML = new XML (e.target.data);

    var it: XMLList = xml. Planter.Lauvtre;

    for (var i: uint = 0; i < il.length (); i ++)

    {

    list.addItem ({data: it.}) Farge.Text ([i]) + "\n"+ it.» Herdighet.Text ([i]) + "\n" + it. Hoyde.text ([i]),

    label: it. Botanisk_navn. Text() [i] + "\n"+ it.» Norsk_navn. Text() [i]});

    }

    }

    Loader.Load (new URLRequest ("lauvtre.xml"));

    Thank you!

    Rheus.

    I don't know what you're trying to do.  but, if you want to fill one combobox with the botanical names and when one is chosen, the other use of logins:

    var loader: URLLoader = new URLLoader();

    loader.addEventListener (Event.COMPLETE, onLoaded);

    list.addEventListener (Event.CHANGE, itemChange);

    function itemChange(e:Event):void {}

    var selectedObj:Object = a [list.selectedIndex]

    trace (selectedObj ['fan'], selectedObj ['Botanisk'], etc);

    }

    var xml;

    var a: Array = [];

    function onLoaded(e:Event):void {}

    XML = new XML (e.target.data);

    var it: XMLList = xml. Lauvtre;

    for (var i: uint = 0; i

    list.addItem({label:il[i].child('Botanisk_navn').toString()});)

    a [i] = {'Fan': it [i].child('Farge').toString (), 'Herdighet': it [i].child('Herdighet').toString (), "Hoyde": he [i].child('Hoyde').toString (), 'Botanisk':il[i].child('Botanisk_navn').toString(),'Norsk_navn':il[i].child('Norsk_navn').toString()};}

    }

    }

    Loader.Load (new URLRequest ("test.xml"));

  • How to remove the newline from the query output?

    Hello

    How to remove the newline from the query output?
    have tried to replace select (column_name, Chr (10), ' ') from table_name.

    Published by: GreenHorn 11 Sep, 2008 12:53 AM

    Please consider, that windows uses a sequence of chr13 | Chr (10) Unix uses only a single character CHR (10).
    The new line characters may depend on the operating system.

    You might consider with:

    Replace (replace (column_name, Chr (13) |)) CHR (10), ' '), CHR (10),' ')

    Hartmut

    Published by: hartmutm on 11.09.2008 01:32

  • How to get the data from more than 100 domains in bulk API V2.0?

    Hi all

    I try to get data from Eloqua by APIs in bulk because of big data.

    But my Contact 186 fields (more than the majority of export limitation 100). I think I need to get all the data by 2 exports.

    How could I corresponds to 2 parts of a line and join together?

    I'm afraid that any change of data between 2 relative to exports 2 synchronizations would make different order.

    FOR EXAMPLE:

    1. any document is deleted or modified (if it matches do not filter) after obtaining data of the first part and before getting the second part, then everyone behind it would have back in part result.

    2. the data in some fields (included in both parts) are changed between the 2 synchronizations, then the values of the second part are more recent but the values of the first part are old.

    All suggestions should.

    Thank you

    Biao

    bhuang -

    I don't know that you ever go to work around the fact that things will change in your database while you are synchronizing the data. You have to have a way to create exceptions on the side of the synchronization.

    If I pushed Eloqua data to a different database and had to contend with the problem of matches change while I'm syncing, I would create a few additional columns in my database to track the status of synchronization for this folder. Or create another small table to track the data map. Here's how I'd do.

    1. I would have two additional columns: 'mapped fields 1' and '2 fields' mapped. They would be all two datetime fields.
    2. I would do only one set of synchronization both. First of all, synchronize all records for email + 99 fields. Do the entire list. For each batch, the datetime value of the lot in 'mapped fields 1' column.
    3. I would then synchronize all folders of email + other 86 fields. Repeat the entire list. For this batch of the datetime value of each batch in their 'mapped the 2 fields' column to now().
    4. For all records that had only 'mapped fields filled, 1' but' fields mapped 2' was empty, I would be re - run the second query Eloqua API using e-mail as the search value. If no results were returned, I would remove the line. Otherwise, update and the value 'mapped fields in 2' now
    5. For all the records that were only "fields mapped 2', I re - run against the first email query API Eloqua, fill in the missing data and define 'mapped the fields of 1' of the current datetime object." If the record has not returned, remove the line because it is probably not in the search longer.
    6. Finally, the value 'mapped fields 1' and 'mapped 2 fields' empty for all records, since you know that data is synchronized. This will allow you to use the same logic above on your next synchronization.

    Who is? It is not super clean, but it will do the job, unless your synchronizations take a ridiculous amount of time and your great data changes often.

  • DV7 - 7333cl: how to extract usable data from a bad drive using 22 pins adapter usb to SATA on the new HD

    Greetings HP Forum,

    Recently, I replaced a bad hard drive on my laptop. I need now step by step procedure to extract usable data from the wrong drive using 22 pins adapter usb to SATA on the new HD.

    NOTE: I can't not all data that especially if some of the software downloaded on the replaced disk can be altered. Should I first download Internet Antivirus to protect my new hard drive? I'm not an expert, or even close to this when you work on the back of the laptop, so I'll have to step by step how to download and to partition the data recoverable and software, etc..

    Thanks in advance for your help... I greatly appreciate it!

    See you soon!

    Wes

    It is not complex. Attach the drive to the adapter and connect it to any other computer with good antivirus and antispyware installed. I use Malwarebytes and Avast. When you connect the adapter with the drive connected to the usb port, the drive will appear and it will be assigned a letter maybe E:\ or F:\ or something else. Immediately, he analyzes with the antivirus and anti-spyware. Quarantine or delete any virus or malware it finds. Then, it's just a matter of navigate the disk and copy and paste the contents of the host computer in a directory for this purpose. Obviously, you can copy from documents word, photos, music files, but you cannot copy the applications like Microsoft Word, iTunes. Photoshop.  You may need to take ownership of the files on the old hard drive, but Windows will guide you through this. Don't know what else I can answer.

  • How to convert string data from the serial port to double?

    Hello!

    I am very new in LabView and attempt to read data from an OHAUS pioneer pa-313 electronic scale via RS232 serial port. I use the VISA. I can read the data and see it as a string to the screen, but when I try to convert it to a double, it is just the integer and decimal numbers have disappeared. Here's the question: what can be the problem? How can I get the decimals as well?

    What is your normal decimal point?. or?

  • How to read the data from a channel named in windows using labview

    Hello

    I need to read the channel named in windows data. The pipe is created by python by another application. This application post permanent data on the pipe. But I don't know how to read data using labview. is it possible to read the data from different application? If possible, how to start?

    Thanks in advance

    concerning

    RJ

    Hi Rolf,.

    It's just, because of driving is not initialized completely, pipe read returns error 42, I added 2 seconds late, then its work perfect.

    Thank you very much.

    Concerning

    RJ

  • How can I read data from my SQLite database?

    I am new to Adobe Air and am playing with creating something simple to insert data into a database and then display it. I was able to insert data successfully but now encounter difficulties to read from the database and display. How can I display data such as a text box or text box?

    This my code for insertion:

    private void sqlConn(dbName___tring,_dbstmt___tring,_dbInsert___tring):void
    {
    sqlC varQLConnection = new SqlConnection ();
    SQLs varQLStatement = new SQLStatement();
    SQLI varQLStatement = new SQLStatement();

    file: var folder = File.applicationDirectory;
    var dbPath:File = folder.resolvePath (dbName);

    sqlc.addEventListener (SQLEvent.OPEN, dbCreated);
    sqlc.addEventListener (SQLErrorEvent.ERROR, dbError);

    sqls.addEventListener (SQLEvent.RESULT, tbCreated);
    sqls.addEventListener (SQLErrorEvent.ERROR, tbError);

    sqli.addEventListener (SQLEvent.RESULT, recCreated);
    sqli.addEventListener (SQLErrorEvent.ERROR, recError);

    sqlc.openAsync (dbPath);

    sqls.sqlConnection = sqlc;
    SQLs. Text = dbstmt;
    SQLs. Execute();

    sqli.sqlConnection = sqlc;
    SQLI. Text = dbInsert;
    SQLI. Execute();
    }

    private void btn_Click (): void
    {
    dbName var= "test.db" tring
    var sqlStatmttring = "CREATE TABLE If NOT EXISTS test_table (id INTEGER PRIMARY KEY AUTOINCREMENT, first_name TEXT, last_name TEXT);
    var sqlInserttring = 'INSERT test_table (first_name, last_name) VALUES('"+txtTaskName.text+"','"+txtTaskDescription.text+"');';
    var sqlReadtring = "SELECT * FROM test_table;"

    sqlConn (dbName, sqlStatmt, sqlInsert);
    }

    That's what I have so far to read the articles. Is this right? How can I use it to display items on one of my opinions?

    private void readItems(dbName___tring):void
    {
    var sqlrQLStatement = new SQLStatement();
    sqlC varQLConnection = new SqlConnection ();
    file: var folder = File.applicationDirectory;
    var dbPath:File = folder.resolvePath (dbName);

    sqlc.openAsync (dbPath);

    sqlr.addEventListener (SQLEvent.RESULT, recFound);
    sqlr.addEventListener (SQLErrorEvent.ERROR, recFoundError);

    sqlr.sqlConnection = sqlc;
    sqlr. Text = "SELECT * FROM test_table ';
    sqlr. Execute();

    Table of results: var = sqlr.getResult () .data;
    }

    Thank you

    They must be in their own class and each class must be in their own folder. If you need a taskClass.as file and a SQLClass in the SQLClass.as file that has the recFound function.

  • How to read in data from MySQL to Authorware?

    Hello

    I'm reading in my authorware (MySQL) database values, but the best I can do is either true or false.
    I would like to be able to get data from the database and return to AW as a string. Does anyone have experience with this? If anyone can lend a hand in this company?

    Thanks in advance for your help,

    Brad

    You'll need some sort of middleware of script, such as PHP or your ASP.
    script will need to:

    * connect to the database
    * query the database
    print the query results

    I use ReadURL to send variables AW to my PHP script, script recovers
    These values and assigns the variables used in the query. Print
    results are returned to the ReadURL. You can also use PostURL.

    In AW, my code for retrieving information from the database looks like this:

    ==================
    Action: = '? action = getData.
    query: = '& student_data_id =' ^ student_data_id
    URLString: = db_loc ^ 'retrieve_data.php' ^ action ^ query
    queryString: = ReadURL (URLString)
    ==================

    I Specifies an action so that the script can contain code for more than one
    the purpose of the trip. My PHP script looks now like the return line (the spirit):

    ==================

    include a script not cached
    include (' lib/no_cache.php');

    connect to the database
    require_once ($_SERVER ['DOCUMENT_ROOT'].)
    '/.. (/ php_secure_scripts/check21/mysql_connect.php');

    create empty var for the holding of output to send to the Authorware
    $output = NULL;

    define queries
    If ((isset($_GET['action'])) & ($_GET ['action'] == 'login')) {/ / set}
    connection request
    $salt = get_salt();
    $query = "SELECT student_id, first_name, last_name, INST_ID select OF.
    students WHERE username = ' {$_GET ['username']} "AND
    password = ENCODE ("{$_GET ['password']}', '$salt'");

    } else if ((isset($_GET['action'])) & ($_GET ['action'] == 'getUserInfo'))
    {/ / set getUserInfo}
    $query = "SELECT inst_name, e-mail, student_data_id, active COURSES."
    LEFT JOIN students student_data USING (course_id) LEFT JOIN to HELP
    (student_id) Using (select INST_ID) WHERE LEFT JOIN institutions
    students.student_id = {$_GET ['sid']} AND courses.sku = {$_GET ['SKU']} ";

    } else if ((isset($_GET['action'])) & ($_GET ['action'] == 'getData')) {}
    query Set getData
    $query = "SELECT course_data, quality, increased FROM student_data WHERE."
    student_data_id = {$_GET ['student_data_id']} ";

    } else {}
    Exit();
    ECHO '.

    No selected query.

    ";
    }

    query the database
    $result = @mysql_query ($query);

    $row = mysql_fetch_array ($result, MYSQL_ASSOC);

    foreach ($row as $key-online $value) {}
    $output = $output. "&" . $key. "=" . $value;
    }

    print $output;

    Close the database
    mysql_close();
    ?>
    ==================

    The returned data is saved in my AW variable called 'queryString' which
    I then analyze in AW. My database connection code is kept in a separate script
    in a location on the server that is not available for browsers. The script
    also contains a custom function that returns a "germ" for the password
    encoding.

    If you need a good book to learn PHP & MySQL, I recommend 'PHP and MySQL '.
    for dynamic Web Sites"by Larry Ullman.
    http://www.Amazon.com/GP/product/0321336577/SR=1-1/QID=1144427020/ref=pd_bbs_1/103-2954060-1860665? % 5Fencoding = UTF8 & s = books

    I hope this gets you on your way!

    --
    _______________________

    Paul Swanson
    Portland, Oregon, United States
    _______________________

    "bradsteele" wrote in message
    News:e161n1$o76$1@forums. Macromedia.com...
    > Hi,.
    >
    > I'm reading in my authorware (MySQL) database values, but
    the
    > I am able to get better is true or false.
    > I would like to be able to get data from the database and return
    for AW

    > string. Does anyone have experience with this? If anyone can lend
    one
    > hand in this company?
    >
    > Thank you in advance for your help.
    >
    > Brad
    >

  • How can I insert data from another table into a table containing a timestamp column

    How you insert data from another table in a table if the target table contains a timestamp column. I tried to set the default value of GETDATE() column in the target table, but it does not work.


    I use MS SQL

    Sorry, I managed to get around this by inserting null as the value

  • How do I import data from Peoplesoft

    Hello

    How can I implement the ability to provide actual figures of peoplesoft?

    Can I do this using HIA?

    Thank you!

    You can use the EIAS for this if the data Essbase (drawn from PeopleSoft) was staged in a star schema. Don't forget that EIS gets very fussy about the format of the star schema, especially if you want to support drill-through of Essbase to relational data (in the star schema).

    Most of my clients simply write a routine extracted (using PL/SQL or another underlying method takes care of data bases) that extracts data from PeopleSoft and stages the data to a text file or in a relational table. Then, create you a rule to load and load the data directly into Essbase. It's much more simple and much more common than the EIS/Star diagram method. Most people use only EIS if relational drill-through is necessary, or if they're building a lot of cubes "disposable" out of the same star schema.

    -Jake

Maybe you are looking for