2 queries must return the same result (but they are not...)

Hello
I have a query:
select col1,extract(year from datum) yr, COUNT(*)
from tableA@dblink where
DATUM between '1-jan-1985' and '31-dec-2012'
and col2 > 100 and col2 not in ('999999')
and TRIM(TO_CHAR(col1)) in ('0','1')
group by col1,extract(year from DATUM);
the query above returns the number: 143 982 for the year 1991
However, when I put the filter directly in this year the request returns a different number: 143 917
select col1,extract(year from datum) yr, COUNT(*)
from tableA@dblink  where
DATUM between '1-jan-1991' and '31-dec-1991'
and col2 > 100 and col2 not in ('999999')
and TRIM(TO_CHAR(col1)) in ('0','1')
group by col1,extract(year from DATUM);
Please can you help me understand why what is happening and why these 2 heads are different?
ID appreciate any advice
Thank you very much
Rgds

Try these...

select col1,extract(year from datum) yr, COUNT(*)
from tableA@dblink where
trunc(DATUM) between to_date('1-jan-1985','dd-mon-yyyy') and to_date('31-dec-2012','dd-mon-yyyy')
and col2 > 100 and col2 not in ('999999')
and TRIM(TO_CHAR(col1)) in ('0','1')
group by col1,extract(year from DATUM);
select col1,extract(year from datum) yr, COUNT(*)
from tableA@dblink  where
trunc(DATUM) between to_date('1-jan-1991','dd-mon-yyyy') and to_date('31-dec-1991','dd-mon-yyyy')
and col2 > 100 and col2 not in ('999999')
and TRIM(TO_CHAR(col1)) in ('0','1')
group by col1,extract(year from DATUM);

Tags: Database

Similar Questions

  • I play old games like "the Lord of the rings." But they are not compatible with my new RESUME. Any help?

    When I start these games he says there are not compatible with the computer.

    Probably because it's Windows 7.

    The back of the games say it is compatible with Windows 95,98, Me, XP...

    But nowhere Win 7, probably because it did not exist at the time.

    Is there a way around this problem? Because I do not just want to throw these games.

    Please any help?

    Hello

    A way to get around is run your machine in XP mode (depending on your version of W7). Please try this

    Kind regards.

  • Printer says I have ink cartridges in the wrong housing but they are not

    I have a printer HP Photosmart 7510 who keeps saying that I have the cartridge in the wrong slot. All 5 are in the correct locations.

    Take a look on the link following which treats problems ink cartridge.  Click here  You did most of these, but do not yet made steps.  The link suggests you clean the contacts again.  Make sure that the cartridges are level with each other.

    If this does not help, I suggest you do a reset of the ink system.  To do this, remove the printhead and ink cartridges.  See this link.  Close the access of transport cover.  Follow the reset instructions in the following link.  Click here  Once the printer rear lights up and indicates that the print head is missing, reinstall the print head.  Close the access door.  When the printer indicates one or more of the ink cartridges are missing, reposition one of them and close the access door until the cartridge shows.  Repeat the process until all the cartridges are reinstalled.  This aid?

  • One of my windows has gone with tabs. I want the back legs, but they are not listed in the recently closed (either Windows or tabs).

    I just spent over an hour on this step to "Fill in the details", and all of a sudden, he is denied access. Firefox is not a copy of this document in its cache. Please tell me you have the document! I am now in tears.


  • Applications show that up to date, but they are not the current versions

    I'm doing OSX 10.8.5 deployable image.

    Office CC tells us that applications are up to date, but they are not.
    I tried to uninstall and reinstall applications, only that she either go to a previous version (the original version of CC) evem and Office CC always said that it is up-to-date.

    I also tried using CC Cleaner and reinstall with the same results.

    I also noticed that CC Cleaner does not seem to remove completely all files from adobe.  In fact, applications of ADVANCED and a few others still remained in the applications folder.

    Can you give me any advice?

    Hi bretts,.

    Please see the steps mentioned in the article: http://helpx.adobe.com/creative-cloud/kb/aam-lists-removed-apps-date.html.

    Kind regards

    Romit Sinha

  • Additional licenses purchased in 2004, but they are not loaded on the server, and they can't find the hard copy of the licenses to load them in.

    Asked me to take over the COMPUTER Department of a small Christian school. They are running SBS 2003. They bought licences for additional client access in 2004, but they are not loaded to the server and they can't find the hard copy of the licenses to load them in. Also, they purhcased of XP Pro and Office 2003 licenses (I have the disks and keys to install but do not know how many licenses they own) and they are not either of the paper copy of these licenses. Is there a way to contact Microsoft to get the licenses? Any help would be appreciated.

    Bill

    original title: recover lost Volume Licensing

    I just figured this out...

    I called the 1-866-230-0560 Option 3 Volume licenses and talked to someone who searched under the name of the school in order to locate licenses. It is even searched under our zip code and found other licenses that have been purchased by the school where the dealer abbreviated the name of the school.

    I hope that this is useful information to others in the same situation.

    Bill

  • to change my earpiece and charger with the new, but they are not defective can I use guarantee of my iPhone to exchange them then?

    I bought my iPhone almost a year ago and he still has warranty valid

    If I want to get new headphones and charger but they are not otherwise defective

    so is it possible that I get new ones even if they are not defective?

    N ° guarantee replaces the defective do not part to which you have become dissatisfied.

  • I recovered the deleted photos, but they do not open in any format

    Mr President.

    I recovered the deleted photos, but they do not open in any format. Please guide me how to open my photos

    Get how and where?

    What is the format (extension) of the recovered files?

    Can you one of the files, right click and choose a program to open it with?

  • Why a pdf form deletes the same data when they are saved?

    Why a pdf form deletes the same data when they are saved?

    As it has been said, in preferences, JavaScript tab. The first entry activates / deactivates JavaScript.

    (just remember to reactivate after making your tests).

    I hope this can help.

    Max Wyss.

  • What is the difference in verses apps for each of the programs to purchase and download it?  They are the same thing and they are simply called "apps"?  Are the applications of complete programs?

    What is the difference in verses apps for each of the programs to purchase and download it?  They are the same thing and they are simply called "apps"?  Are the applications of complete programs?

    Yes.

    Adobe uses confusion of terminology in their efforts to explain things.

    Cloud desktop applications are the same as the purchase of the software on disk in the days avant-nuage. for example, the Photoshop Cloud desktop application is the full version of Photoshop CC 2015.

  • I have Acrobat Pro XI and have not the redaction tools available.  I looked under Protection, but they are not there. I'm on version 11.0.12. where can we find them?

    I have Acrobat Pro XI and have not the redaction tools available.  I looked under Protection, but they are not there. I'm on version 11.0.12. where can we find them?

    Are you sure have the Pro version and not the Standard version?

  • I want to enter the information specific to my camera and lens corrections lens P options'shop 2014 and 2015 the room but they are not on the list. (D-750 of Nikon with 24-120 lens). How can I fix it?

    I recently upgraded to a Nikon D 7000 to a D-750 with the Nikkor 24-120 mm, but they are not on the list of options in P'shop or Lightroom under profiles of cameras and objectives. Since every tutorial I've read on the suggested 24-120 lens fixing distortion problems in P'shop, how to make the choice without these specific products being on the list? (P'shop, 2014, 2015 the room)

    In Lightroom, have you tried the automatic correction of profile? In addition, I don't think that there are and the support profile of correction for digital SLRs so you shoot JPEG.

    Benjamin

  • Said CC my apps are updated, but they are not on my computer. What's the skinny?

    Said CC my apps are updated, but they are not on my computer

    Hi AaronUF,

    Please follow the mentioned kb: http://helpx.adobe.com/creative-cloud/kb/aam-lists-removed-apps-date.html .

    Kind regards

    Romit Sinha

  • I use hyperlinks of Keynote, but they are not working when I connect to a projector AV. Any ideas?

    I use hyperlinks of Keynote, but they are not working when I connect to a projector AV. Any ideas?

    Hyperlinks don't work in the presentation on the projection screen, not 'View presenter' on Mac to display.

  • dkafox1 lost all THE WINDOWS updates that THEY ARE NOT INSTALLED UPDATES

    Original title:

    dkafox1 lost all THE WINDOWS updates that THEY ARE NOT INSTALLED UPDATES, more problems with windows update. May HAVE a PROBLEM WITH REGISTRATION BUT DO KNOW NOT if this msi I HAVE HELPED.

    I have windows 7 x 64 Version 6.1.7600.16385. My windows update has only downloaded and installed a fix (KB947821 on 22/03/14. In the event err log # 2147942487command line: "C\:WINDOWS\SYSTEM32\WUSA '". "»» "EXE" "Windows Update Troubleshooter said" search for missing or corrupted files. I did a sfc/scannow and everything was fine, that the settings are incorrect... Went to computer management by looking at the windows log. Event ID was found in respect of the implementation of 3. Looks like I've lost all my updates. Window update is only showing KB947821 HOT of difficulty. All my other downloading updates for the past two weeks included Microsoft Office Update that I can't see anything there all gone. I check the installed updates and 14 updates that don't settle all gone. Windows Update indicates any problem or error #. It says Windows update installed "Never". I tried the solution to the difficulty of corruption problems MSI software update registration. Help I don't know where to go from here. I ran the windows Memory Diagnostic tool, which came with no error. In the community he sent me to back registry which I do not know how to do. Can I save on my hard drive or another source. He says type reedit32.exe. I have the windows 7 registry editor wants me to save the registry key or subkey > I do not know what files to back up or export. I'm not computer savvy, but I do what I can do better. Had problems with windows update not install and now not download or install 2 MOS. So where and how can I know what updates I need after that this problem is corrected.  Thank you

    If you want Office 2007 updates to appear in the installed updates again, you would need to uninstall/reinstall Office 2007 and install all the updates again.

    Assuming that Office 2007 is installed & working properly and no update is offered when you run a manual check for updates now, you might want to leave enough alone (that is, do nothing) - then see if the 2 updates for Office 2007 SP3 be released next Tuesday (a) receive, (b) successfully install and (c) are listed in the installed updates later.

    PS: The possible causes of the problem are messing with registry cleaners, messing around with the Software Distribution folder, and the fact that it was a computer refurbished when you bought it.

Maybe you are looking for