Re: Select statement

From: Hugo Kornelis (hugo_at_pe_NO_rFact.in_SPAM_fo)
Date: 06/18/04


Date: Fri, 18 Jun 2004 22:47:50 +0200

On Fri, 18 Jun 2004 09:30:01 -0700, D Mack wrote:

>What a dunce! The statement below does work. This is what doesn't:
>
>select (convert(char(10), ae_p_wka_e.sched_date, 101)) = (convert(char(10), getdate() - 2, 101)) from ae_p_wka_e
>
>I'm trying to narrow down the choice of records before I do anything else with them.
>
>Thanks.

Hi D,

I'm not entirely sure what you would want this statement to do. Are you
trying to get a true/false result for each row? If so, try:

  SELECT CASE
           WHEN ae_p_wka_e.sched_date IS NULL
             THEN 'Unknown'
           WHEN convert(char(10), ae_p_wka_e.sched_date, 101) =
                convert(char(10), getdate() - 2, 101)
             THEN 'True'
             ELSE 'False'
         END
  FROM ae_p_wka_e

If this is not what you want, please post:

* DDL (CREATE TABLE statements, including all constraints)
* Sample data (as INSERT statements)
* Expected output

Best, Hugo

-- 
(Remove _NO_ and _SPAM_ to get my e-mail address)


Relevant Pages

  • Re: TRICKY SQL
    ... irrelevant columns) and your sample data as INSERT statements, ... Best, Hugo ... (Remove _NO_ and _SPAM_ to get my e-mail address) ...
    (microsoft.public.sqlserver.programming)
  • Re: any faster solution?
    ... >set nocount off ... The sample data provided is not enough to come to ... Best, Hugo ... (Remove _NO_ and _SPAM_ to get my e-mail address) ...
    (microsoft.public.sqlserver.programming)
  • Re: Select from 2 tables
    ... >LEFT JOIN Products AS p1 ... Without sample data, I fail to see what you mean. ... Best, Hugo ... (Remove _NO_ and _SPAM_ to get my e-mail address) ...
    (microsoft.public.sqlserver.programming)
  • Re: How to synch up values from multiple tables into a single row
    ... The expected output, based on the sample data provided. ... any SQL code you are already using, ... getting from it (if it's an error message: ...
    (microsoft.public.sqlserver.programming)
  • Re: Extremely complicated problem :(
    ... >their associated charges, payments and adjustments + the payer name ... If you do want help writing the query, ... Sample data that is illustrative of your problem. ... Expected output, based on the sample data given; ...
    (microsoft.public.sqlserver.programming)