Re: someone double-check me on this sql

From: Subodh Deshpande <deshpande.subodh_at_gmail.com>
Date: Mon, 2 Jul 2012 13:12:28 +0530
Message-ID: <CAJsOtB4gs-Q-N57K09z_5QkEPM_GTS8SfFHgSoaf1JPr-uOaVg_at_mail.gmail.com>



hi Chris,
I would have used month in ('1','2','3','4','6','7','8','9','10','11','12') and would have used year <= 2012

Yes, in real life we clean the food grains by picking up the stones in it and in oracle reverse faster and efficient..

On 29 June 2012 08:05, Taylor, Chris David < ChrisDavid.Taylor_at_ingrambarge.com> wrote:

> I'm a bit fuzzy at the moment due to pain meds after a minor surgery so
> I'm hoping someone can spot my error (if I have an error)
>
> Table has months, years and 'x' number of rows for each
>
> The table has Years 2011 and 2012
> In 2011, it has months 1-12
> And in 2012 it has months 1-5
>
> I run this:
> Select month, year, count(*) -- month, and year are actual column names
> From some_table
> Where (month != 5 and year != 2012)
> Group by month, year
> /
>
> The data set I get is Months 6-12 for 2011 *ONLY*
>
> Shouldn't that query *ONLY* exclude MONTH=5 and YEAR 12 together?
> (instead of ALL 2012 and ALL 5s?)
>
>
>
>
> Chris Taylor
>
> "Quality is never an accident; it is always the result of intelligent
> effort."
> -- John Ruskin (English Writer 1819-1900)
>
> Any views and/or opinions expressed herein are my own and do not
> necessarily reflect the views of Ingram Industries, its affiliates, its
> subsidiaries or its employees.
>
>
>
>
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>

-- 
=============================================
This Gmail Account will be deactivated  in One Months Time
=============================================


--
http://www.freelists.org/webpage/oracle-l
Received on Mon Jul 02 2012 - 02:42:28 CDT

Original text of this message