🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #730

Re: Combine data 2 records

#730
From: MrT
Date: Mon, 06 Aug 2007 05:55
66 lines
3031 bytes
Bill Todd wrote:
Bill Todd wrote:
> MrT wrote:
> 
>> The id is the only one effectively GROUP BY.
> 
> That is correct. The first query should return the the result you want
> with the GROUP BY ID added.
> 

> MrT wrote:
> 
>> The id is the only one effectively GROUP BY.
> 
> That is correct. The first query should return the the result you want
> with the GROUP BY ID added.
> 

Thanks.

I am not getting this.
What do I do at <----- below to get what I want?

I can't CAST(MAX(m."RENEW_DTE") AS VARCHAR(10)) says invalid.

The problem is that the where criteria will get me two records, one for 
2007 d1 and another for 2008 d2 and I want the result to utilize those 
values in one returned "record".  I think I need temp table as the only 
way. Brain dead right now. Sleep!!

SELECT
        CAST(m."ID" AS INTEGER) AS ID,
        'bong' || (CAST(CAST(m."ID" AS INTEGER) AS VARCHAR(10))),
        m."PWORD",
        PROPERCASESTRING(m."NAMEFIRST",''),
        PROPERCASESTRING(m."NAMELAST",''),
        PROPERCASESTRING(m."DBA",'') ,
        '' ,
        m."EMAIL" ,
        m."PHONE" ,
        CAST(m."RENEW_DTE" AS VARCHAR(10)),  <-----
        SUBSTR(m."NAMEFIRST",1,1) || 'boca' || SUBSTR(m."NAMELAST",1,1) ,
        CAST(m2."CRDRPT_RNW" AS VARCHAR(10))    <----------
FROM
     "MEMBERS" m
     LEFT OUTER JOIN "MEMPAY2" m2 ON m."ID" = m2."ID"
WHERE
  (
  (m."PWORD" IS NOT NULL) AND
     (
     ((m2."YEARM2" = (Extract(Year from CURRENT_DATE))) AND 
(m2."RENEW_DATE" IS NOT NULL) and (m2."DATE_PAID" IS NULL )) or

     ((m2."YEARM2" = (Extract(Year from CURRENT_DATE) - 1)) AND 
(m2."RENEW_DATE" IS NOT NULL) and (m2."DATE_PAID" IS NULL)) or

     ((m2."YEARM2" = (Extract(Year from CURRENT_DATE) + 1)) AND 
((m2."RENEW_DATE" IS NOT NULL) or (m2."CRDRPT_RNW" IS NOT NULL))) OR

     ((m2."YEARM2" = (Extract(Year from CURRENT_DATE) + 1)) AND 
((m2."DATE_PAID" IS NOT NULL) or (m2."CRDRPT_PD" IS NOT NULL)))
     )
)


ORDER BY m.ID ASC
Technical Details
Message-ID: <46b6a9b3@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <46b641b6@newsgroups.borland.com> <46b644a4$1@newsgroups.borland.com> <46b655fa@newsgroups.borland.com> <46b662de$1@newsgroups.borland.com> <46b679a5@newsgroups.borland.com> <46b68537@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,509bc3ea097a54b
X-Google-Attributes: gid114a0e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Mon, 06 Aug 2007 00:55:41 -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: Re: Combine data 2 records
References: <46b641b6@newsgroups.borland.com> <46b644a4$1@newsgroups.borland.com> <46b655fa@newsgroups.borland.com> <46b662de$1@newsgroups.borland.com> <46b679a5@newsgroups.borland.com> <46b68537@newsgroups.borland.com>
In-Reply-To: <46b68537@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 69.39.70.140
Message-ID: <46b6a9b3@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1186376115 69.39.70.140 (5 Aug 2007 21:55:15 -0700)
Lines: 66
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail