Article View: borland.public.interbase.sql
Article #735New Thread Combining data 2 records
From: MrT
Date: Tue, 07 Aug 2007 00:37
Date: Tue, 07 Aug 2007 00:37
38 lines
2657 bytes
2657 bytes
Hi:
This is small test example of what I want and the query that produced
it. I am having problem with filtering the records with where clause
like I said earlier. The problem is the selection criteria is not
mutually exclusive.
Perhaps my subject line was misleading.
Anyway, this is how I am using F_MAXDATE.
select m.id, m2.id, m2.yearm2, m2.crdrpt_rnw, m3.id, m3.yearm2,
m3.crdrpt_rnw, F_MAXDATE(m2.crdrpt_rnw, m3.crdrpt_rnw)
FROM
"MEMBERS" m
LEFT OUTER JOIN "MEMPAY2" m2 ON m."ID" = m2."ID"
INNER JOIN "MEMPAY2" m3 ON m2."ID" = m3."ID"
where m2.yearm2 = '2007' and m3.yearm2 = '2008' and ((m2.crdrpt_rnw is
not null and m3.crdrpt_rnw is null) or
(m2.crdrpt_rnw is
not null and m3.crdrpt_rnw is NOT null))
Example of output:
173 173 2007 01/12/2007 173 2008 01/12/2008 01/12/2008
176 176 2007 06/02/2007 176 2008 06/02/2008 06/02/2008
178 178 2007 06/22/2007 178 2008 06/22/2008 06/22/2008
180 180 2007 01/02/2007 180 2008 01/02/2008 01/02/2008
182 182 2007 04/12/2007 182 2008 04/12/2008 04/12/2008
200 200 2007 08/13/2007 200 2008 08/13/2008 08/13/2008
205 205 2007 02/09/2007 205 2008 02/09/2008 02/09/2008
206 206 2007 02/16/2007 206 2008 02/16/2008 02/16/2008
217 217 2007 08/30/2007 217 2008 08/30/2007
218 218 2007 02/23/2007 218 2008 02/23/2008 02/23/2008
220 220 2007 12/03/2007 220 2008 12/03/2007
224 224 2007 05/21/2007 224 2008 05/21/2008 05/21/2008
230 230 2007 10/13/2007 230 2008 10/13/2007
Technical Details
Message-ID:
<46b7b088@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!feeder.news-service.com!194.25.134.62.MISMATCH!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,633e86cefe754509,start X-Google-Attributes: gid114a0e,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 06 Aug 2007 19:37:24 -0500 From: MrT <contact@heat-mi.org> User-Agent: Thunderbird 1.5.0.12 (Windows/20070509) MIME-Version: 1.0 Newsgroups: borland.public.interbase.sql Subject: New Thread Combining data 2 records Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 69.39.70.212 Message-ID: <46b7b088@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1186443400 69.39.70.212 (6 Aug 2007 16:36:40 -0700) Lines: 38 Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!feeder.news-service.com!194.25.134.62.MISMATCH!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail