How to select the data that meet multiple criteria

name load_date
-------- ----------------
Smith 11/02/2010
John 01/10/2009
Cindy 03/04/2010
Smith 03/10/2010


I want to select all names including load_date exist in February AND March.

Expected results: -.

Smith

I can use the intersect operator to get all the names that were given in February AND March by using the following query.

Select the name of the table where to_char ("load_date, ' FMMonth YYYY") = "February 2010"»
intersect
Select the name of the table where to_char ("load_date, ' FMMonth YYYY") = "March 2010"»


Y at - it an easier way to retrieve the same data that is similar to the use group by, having cluase etc?

Thanks in advance.

Hello

You can do it in one pass through the table with GROUP BY and HAVING:

SELECT       name
FROM       table_x
WHERE       load_date     >= DATE '2010-02-01'     -- First date inside target range
AND       load_date     <  DATE '2010-04-01'     -- First date OUTSIDE target range
GROUP BY  name     -- not TRUNC (load_date, 'MONTH')
HAVING       COUNT (DISTINCT (TRUNC (load_date, 'MONTH')))     = 2
;

Try to keep the columns indexed by themselves in comparisons; in this way, you can use indexes.
For example, if there is an index on load_date, then the above query could use, as load_date is only on one side of the > = or<>
A similar State

where   to_char (load_date, 'FMMonth YYYY') = 'February 2010'

cannot use an index on load_date, because we do not compare load_date - we compare the results of TO_CHAR (load_date,...).

Published by: Frank Kulash, April 13, 2010 16:44
Fixed GROUP BY clause

Tags: Database

Similar Questions

  • How to restore the data that was on my computer 3 days ago

    original title: restore data

    Can someone tell me please how to restore my computer had on it three days ago? I'm on the ignorant point, so please tell me what buttons to push and in what order. Thank you very much.

    Sorry its start Classic.

    You have:

    Start - All Programs - Accessories - System Tools and system restore.

    Check "restore my computer to an hour of Earle" and select the date and "Next"

  • How to display the data, that contains non-numeric characters.

    Hello

    I have table t1 with column of type varchar2 below

    ID

    ------

    11151

    11412

    1113

    1 to 114

    11b 15

    111 6

    Now, I need to display the data, that contains non-numeric characters.

    Did you get the result like:

    STR

    ----------

    1 to 114

    11b 15

    111 6

    WITH t
         AS (SELECT '11151' str FROM DUAL
             UNION ALL
             SELECT '11412' FROM DUAL
             UNION ALL
             SELECT '1113' FROM DUAL
             UNION ALL
             SELECT '1a114' FROM DUAL
             UNION ALL
             SELECT '11b15' FROM DUAL
             UNION ALL
             SELECT '111c6' FROM DUAL)
    SELECT *
      FROM t
      where regexp_like(str,'[^[:digit:]]');
    

    See you soon,.

    Manik.

  • How to identify the data that is associated with any book in crm on demand?

    We are experimenting with books, but I have yet to find an easy way to identify the data that are not associated with any book.

    Do you have a suggestion?

    I discussed this with Oracle in recent years CAB, but we have no indication if it will be included, but it could be part of their 'User' hotel subject they are studying.

  • How to select the details that write in EXIF

    Hello

    I want Lightroom to write to the EXIF, the following data:

    • Artist
    • Copyright
    • Serial number
    • Camera model
    • Lens type

    And avoid recording information such as:

    • exhibition, number f, iso, white balance, etc.?

    Is it possible somehow to choose what will save the software?


    Thank you

    The answer depends on where you try to write files. Do you want to write in the original files or exported files?

    If you want to select specific EXIF metadata elements to write in the files that you export, you can do that by using only Lightroom, but you can do this by adding a Lightroom plug-in. I use the Metadata Wrangler by Jeffrey Friedl. It gives you a lot of control accurate on what is written, and that includes the camera data.

    If you want to rewrite the EXIF metadata in the original files, especially the original raw files, is not possible to use Lightroom to do.

    Synchronization metadata will not help because it changes IPTC and other metadata, but not EXIF.

  • How to find the date that a bookmark was made?

    It does not work:
    Go to the Menu bookmarks > show all bookmarks, then click Date of visit, top right middle.

    The visit Date column is just blank.

    If you want that the date on which the bookmark was created, then you have the added column.

    Make sure you keep the history and are not in private browsing mode in the visits column is empty.

  • How to create the data store with multiple LUNS

    Someone could please tell me that how can I have multiple LUNS in a single data store, is it possible?

    See the "Storage management" section in the document provided in the previous comment. You are probably looking for information on page 104.

  • How to extract the data that ends with GG replicat process all ignore replicat parameter is ued for installing bidrectiona?

    Hi all

    I have 2 DBs in the two-way GG configuration and using ignore replicat parameter to avoid a loop. I want to know if another application also sends data via GG to one of the DBs and want to include that data extract, process that must be sent to the downstram system.

    Thank you

    Traoré

    I fixed the problem by putting in place the parameter called NOTRACETABLE.

    Thank you all for your support.

    Traoré

  • How to check the data that are not digital?

    I have a varchar field and I would check for all of the lines where it does not contain a numeric value. How can I achieve this?
    Thanks in advance.

    One option is to write a small function

    CREATE OR REPLACE FUNCTION is_numeric( p_str IN VARCHAR2 )
      RETURN NUMBER
    IS
      l_num NUMBER;
    BEGIN
      l_num := to_number( p_str );
      RETURN 1;
    EXCEPTION
      WHEN others THEN
        RETURN 0;
    END;
    

    only then can you call

    SELECT *
      FROM some_table
     WHERE is_numeric( some_string_column ) = 0
    

    Of course, you can adapt the function to return the numeric value rather than a 1 or a 0 more.

    Justin

    Published by: Justin Cave on June 21, 2011 18:15

    Depending on the version of Oracle (which you don't mention), you can also write a regular expression to search for things other than numbers. This can become a little difficult if you have to manage commas and dots as decimal separators and grouping because different regions use the symbols differently and have different rules about what are valid models.

  • 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.

  • Multiple column trees: how to access the data in columns? There is a bug?

    Hello

    I have a strange problem. I use tree column multi like this:

    In this case, I have the tree column and two other custom columns.

    Now, how to access the data in the SECOND column?

    We can write all the data in a row thanks the EditElementTree:AddElement:ChildText, because it is an array of strings.

    However, when I want to read the data, I use ActiveCelltring, meaning that a SINGLE string and not a string table oO (so I only have the value of the first column and never others.

    So, I can do what I want? Is this a bug?

    Thank you very much

    R0b1n

    OK, I have the solution.

    We play with the ActiveColumnNumber attribute, to read the values of different...

    I left the message, it may be useful for later someboby

    R0b1n

  • What ever the data that we are loading in HFM, how to check if the data are correct or not?

    Hello!

    This is SANDEEP, I loaded data using FDM in HFM. How to check if the data is correct or not, what ever the data I was responsible in HFM.

    Please tell me how to recover the data and what format, clearly can you me the data verification process step by step.

    It would be useful for me...

    Thanks in advance...

    Kind regards

    SANDEEP

    Hi Sandeep,

    I think the best way is to extract data from HFM for the same POV that you have loaded FDM and check if it is the same.

    If you then use HFM 11.1.2.x version

    1. login to the application and go to the menu Administration / extract / data.

    2. set the POV that you have loaded the data, then unzip it. You can open the file unzipped in a notebook

    3. you can compare the file with the data file generated by FDMEE under Outbox folder.

    But what would you give all the data corresponding to the POV that you set. So please ensure that you have the correct POV, defined according to the export FDMEE.

    Thank you

    Chandra

  • How can I get rid of the blue name and the date that is entered under the signature

    How can I get rid of the blue name and the date that is entered under the signature

    Yes! you see Configure text where you can uncheck date Logo etc...

    For more information, see image

  • How to select a rectangle that was inserted into the Clipboard?

    For inserting images batch execution, I am faced with this situation:

    There is a document with a large number of paragraphs containing a file name of image as "034.tif."

    I have a rectangle that has the exact size and style how the images should be placed.

    I copy it to the Clipboard.

    Then I run a script which seeks names of image files and replaces them with the contents of the Clipboard (the desired rectangle).

    If the script ends here, the cursor is placed directly after the just inserted rectangle.

    How the script can select the rectangle on the left of the slider so that the image is inserted into the rectangle instead of after him?

    The script looks like this:

    copy the rectangle desired the Clipboard manually

    app.changeGrepPreferences = NothingEnum.nothing;
    app.findGrepPreferences.findWhat = "002.tif";
    app.changeGrepPreferences.changeTo = "~ c";
    myPlace var = app.changeGrep ();

    This is the point where I have to select the rectangle that changeGrep just inserted

    concerned about myPlace [0] ('002.tif', false);

    Your script as written will replace all occurrences of the text in all documents open with the contents of the Clipboard, sort of 'selection', the result could be problematic. However, you can get an array of references to the result like this:

    var myPlaces = app.changeGrep ();

    for (var j = 0; myPlaces.length > j; j ++) {}

    var myRect = myPaces [j] .rectangles [0]; assume that the content of the Clipboard was indeed a rectangle

    var myRect.place ('002.tif', false);

    }

    Even though I'm doubtful that you can simply pass the name of made it to the set command. I myself spend a full file reference.

    The point here is that the changeGrep command returns an array of references to text for the amended text. Each of your texts has changed (even if there is only one) is a character containing an inline or anchored, rectangle that is referenced as the first member of the collection of rectangles by the character.

    Dave

  • How to locate the record that indicates a library search result (bookmarks)?

    When doing a search in the signet library and you get a result (s) URL of the file that contains the information of the URL is unknown or apparently unknown. How can I find the folder that stores the bookmark information.
    Information on the result (name, location, Tags, keywords, Description) appears, but there is no information related to where in the library, the data are stored. For example, the folder that contains that contains this information.

    I found this extension is more suitable for my use: https://addons.mozilla.org/en-US/firefox/addon/7372/

    After install and restart Firefox

    • Open the 'library' bookmarks > show all bookmarks
    • Right-click on the right pane of the column headings, check / click the headins column you want to display. Parent folder column is added by on the extension
    • Drag the column headers left and right for the postion that meet your needs.

    Another extension you can consider: https://addons.mozilla.org/en-US/firefox/addon/go-parent-folder/

    If this answer solved your problem, please click 'Solved It' next to this response when connected to the forum.

    Not related to your question, but...

    You must update some plug-ins:

Maybe you are looking for