🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.vdbase.data.sql
Article #274

Re: Obtaining Age

#274
From: Geoff S. Wass
Date: Mon, 21 Dec 1998 00:00
38 lines
1961 bytes
Gerald,

You can use the SET FIELDS TO to set a calculated field. For example, to
get a field called theMonth from InvoicDate (which is of type DATE), you
could do this:

SET FIELDS TO ALL    && to get all existing fields
SET FIELDS TO myMonth=MONTH( InvoicDate )    && use the dBASE expression

However, the SQL SELECT statement cannot work on this table directly
since it (being non-procedural) is going to open its own view of the
data you tell it to work with. So you would have to save this to a temp
file. I would apply your "WHERE" clause criteria as much as possible to
make the temp as small as possible.

So you could...

COPY TO tempTable FOR myMonth = 4 WITH PRODUCTION
&& keep indexes for SQL

SELECT * FROM tempTable && etc.

This is not a 100% SQL solution like your were seeking, but it should
run just as fast and give you the results you need.


--
Geoff Wass
Kuala Lumpur, Malaysia


== In news groups use a reply (not e-mail) so all can help and learn!
==
== Report Inprise/Borland bugs...
== http://www.inprise.com/devsupport/bugs/bug_reports.html
== dBASE Archives http://forumsearch.borland.com:88/
== or http://www.dejanews.com
== Alan Katz's Visual dBASE Magazine http://www.ksoftinc.com/vdb/
Technical Details
Message-ID: <367DBB71.C0B4E892@ibm.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <MPG.10e4a81d2baa73d39897d4@forums.borland.com> <367b1a23.10660941@forums.borland.com> <MPG.10e60f20e28f90ab9897d5@forums.borland.com> <367C99EC.C650F91@ibm.net> <MPG.10e721e224f6f8f9897d7@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff5a1,13e5acd5c576586a
X-Google-Attributes: gidff5a1,public
From: "Geoff S. Wass" <gswass@ibm.net>
Subject: Re: Obtaining Age
Date: 1998/12/21
Message-ID: <367DBB71.C0B4E892@ibm.net>
X-Deja-AN: 424375350
Content-Transfer-Encoding: 7bit
References: <MPG.10e4a81d2baa73d39897d4@forums.borland.com> <367b1a23.10660941@forums.borland.com> <MPG.10e60f20e28f90ab9897d5@forums.borland.com> <367C99EC.C650F91@ibm.net> <MPG.10e721e224f6f8f9897d7@forums.borland.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Noordindarus Consultancy Sdn. Bhd.
Mime-Version: 1.0
Newsgroups: borland.public.vdbase.data.sql