Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

compare month and days between the two date column

3 posts in General Discussion Last posting was on 2009-07-20 18:33:57.0Z
AJ Posted on 2009-07-16 18:39:28.0Z
Sender: 3b1b.4a5f6a92.1804289383@sybase.com
From: AJ
Newsgroups: sybase.public.ase.general
Subject: compare month and days between the two date column
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4a5f73e0.4185.1681692777@sybase.com>
NNTP-Posting-Host: forums-3-dub.sybase.com
X-Original-NNTP-Posting-Host: forums-3-dub.sybase.com
Date: 16 Jul 2009 11:39:28 -0700
X-Trace: forums-3-dub.sybase.com 1247769568 10.22.241.188 (16 Jul 2009 11:39:28 -0700)
X-Original-Trace: 16 Jul 2009 11:39:28 -0700, forums-3-dub.sybase.com
Lines: 8
Path: forums-1-dub!forums-master!forums-3-dub.sybase.com!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28013
Article PK: 77261

Hello,
I have two columns as below; I am trying to write a query to
find out the non-match dates between month and days between
the two columns below. I only need row 1 b'cos 01/09 <>
01/03. Thanks in advance.
id expiration_date effective_date
1 01/09/2009 01/03/2008
2 05/03/2010 05/03/2005


Sherlock, Kevin [TeamSybase] Posted on 2009-07-16 19:26:53.0Z
From: "Sherlock, Kevin [TeamSybase]" <kevin.sherlock@teamsybase.com>
Newsgroups: sybase.public.ase.general
References: <4a5f73e0.4185.1681692777@sybase.com>
Subject: Re: compare month and days between the two date column
Lines: 18
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4a5f7efd$2@forums-3-dub.sybase.com>
Date: 16 Jul 2009 12:26:53 -0700
X-Trace: forums-3-dub.sybase.com 1247772413 10.22.241.152 (16 Jul 2009 12:26:53 -0700)
X-Original-Trace: 16 Jul 2009 12:26:53 -0700, vip152.sybase.com
X-Authenticated-User: teamsybase
Path: forums-1-dub!forums-master!forums-3-dub.sybase.com!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28014
Article PK: 77260

Several ways. Here's one:

select *
from mytable
where datepart(mm,expiration_date) <> datepart(mm,effective_date)
or datepart(dd,expiration_date) <> datepart(dd,effective_date)

<AJ> wrote in message news:4a5f73e0.4185.1681692777@sybase.com...
> Hello,
> I have two columns as below; I am trying to write a query to
> find out the non-match dates between month and days between
> the two columns below. I only need row 1 b'cos 01/09 <>
> 01/03. Thanks in advance.
> id expiration_date effective_date
> 1 01/09/2009 01/03/2008
> 2 05/03/2010 05/03/2005


AJ Posted on 2009-07-20 18:33:57.0Z
Sender: 3b1b.4a5f6a92.1804289383@sybase.com
From: AJ
Newsgroups: sybase.public.ase.general
Subject: Re: compare month and days between the two date column
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4a64b895.244b.1681692777@sybase.com>
References: <4a5f7efd$2@forums-3-dub.sybase.com>
NNTP-Posting-Host: forums-3-dub.sybase.com
X-Original-NNTP-Posting-Host: forums-3-dub.sybase.com
Date: 20 Jul 2009 11:33:57 -0700
X-Trace: forums-3-dub.sybase.com 1248114837 10.22.241.188 (20 Jul 2009 11:33:57 -0700)
X-Original-Trace: 20 Jul 2009 11:33:57 -0700, forums-3-dub.sybase.com
Lines: 21
Path: forums-1-dub!forums-master!forums-3-dub.sybase.com!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:28017
Article PK: 77263

Thanks a bunch Kevin!

> Several ways. Here's one:
>
> select *
> from mytable
> where datepart(mm,expiration_date) <> datepart(mm
> ,effective_date)
> or datepart(dd,expiration_date) <> datepart(dd
> ,effective_date)
>
> <AJ> wrote in message
> > news:4a5f73e0.4185.1681692777@sybase.com... Hello,
> > I have two columns as below; I am trying to write a
> > query to find out the non-match dates between month and
> > days between the two columns below. I only need row 1
> > b'cos 01/09 <> 01/03. Thanks in advance.
> > id expiration_date effective_date
> > 1 01/09/2009 01/03/2008
> > 2 05/03/2010 05/03/2005
>
>