🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Where can I find a summary of how to use Local SQL?

#587
From: Norbert Hartkamp
Date: Sun, 13 Sep 1998 00:00
33 lines
1922 bytes
Gary (Gary White) wrote:

>If you look up the topic "Local SQL" in the help file, then use the
>browse arrows (<< and >>), you'll find most of what you want.
>However, I've found that "select * from tablename" to be adequate for
>nearly everything I've done.  Use the data objects for everything
>else.
>
>Gary

Thank you for your reply. Maybe you're right, but mayby it's true only
after you've mastered all the secrets of the SELECT statment.

For example: I have a table (called "WEEK") with certain data from
patients, that stay in a hospital typically between 3 and 6 month.
Data in this table are gathered weekly. I have another table in which
there are other data (SCL-90-R in that case) gathered in 4 week-
intervals. All patients have a unique number "DSNR". Both tables of
course have a Date-field (called "DATUM). How can I build a
SQL-statement that gives me in each row:

DSNR, admission date ( MIN(week.datum) ?? ), discharge date 
( MAX(week.datum) ?? ), SCL.scores from the  first week (same date as
MIN(week.datum) ) and scl.scores from MAX(week.datum).

In addition I would like to have the scl-scores from that date, that
is closest to mid-treatmen, where mid-treatment can be computed as 

MIN(week.datum)+((MAX(week.datum)-MIN(week.datum))/2).

Any idea (if I suceeded to make clear, what I need)?

Regards, N. Hartkamp
Technical Details
Message-ID: <35fc2089.7296565@forums.inprise.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <35fb74c0.2160758@forums.inprise.com> <35fd9b9d.86957134@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff5a1,a20027fb5686ac95
X-Google-Attributes: gidff5a1,public
From: hartkamp@uni-duesseldorf.de (Norbert Hartkamp)
Subject: Re: Where can I find a summary of how to use Local SQL?
Date: 1998/09/13
Message-ID: <35fc2089.7296565@forums.inprise.com>
X-Deja-AN: 390767636
References: <35fb74c0.2160758@forums.inprise.com> <35fd9b9d.86957134@forums.borland.com>
Organization: hartkamp@uni-duesseldorf.de
Reply-To: hartkamp@uni-duesseldorf.de
Newsgroups: borland.public.vdbase.data.sql