Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: A query that uses not equals

Re: A query that uses not equals

From: Jim Kennedy <kennedy-family_at_attbi.com>
Date: Sun, 27 Oct 2002 19:08:28 GMT
Message-ID: <MQWu9.135715$La5.451849@rwcrnsc52.ops.asp.att.net>

  1. strings!=dates
  2. each date component has a time try:

 SELECT CUSTOMER.CUS_CODE, CUSTOMER.CUS_BALANCE  FROM CUSTOMER, INVOICE
 WHERE (INVOICE.INV_DATE <to_date('08/18/1999','mm/dd/yyyy') or

                INVOICE.INV_DATE >=to_date('08/20/1999','mm/dd/yyyy')
 ORDER BY CUSTOMER.CUS_CODE; which says everything before 8/18/1999 at midnight and everything on or after 8/20/1999
Use to_date to explicitly convert string constants to dates. Otherwise, if someone has set their client to dd/mm/yyyy then you will get an error or the wrong results (or other implicit date conversion formats, always do the explicit conversion - makes code easier to read and less prone to error.) Jim

"Cherron" <twitched_at_msn.com> wrote in message news:bd72678d.0210271036.41af0fe2_at_posting.google.com...
> I have a customer table
>
> cus_code PK
> cus_balance
>
> and a invoice table
>
> cus_code FK
> inv_number
> inv_date
> invo_items
>
> I need to be able to select the customers that did not make purchases
> on 8/18/1999 and 8/19/1999
>
> The code that I came up which is listed below does not work because
> the syntax is wrong and I gues the logic as well.
>
> SELECT CUSTOMER.CUS_CODE, CUSTOMER.CUS_BALANCE
> FROM CUSTOMER, INVOICE
> WHERE INVOICE.INV_DATE != "08/18/1999" OR INVOICE.INV_DATE != "
> 08/19/1999"
> ORDER BY CUSTOMER.CUS_CODE;
>
> Can anyone tell me what I am doing wrong? I would appreciate your
> help.
>
> Thanks
Received on Sun Oct 27 2002 - 13:08:28 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US